| 1 |
<?php |
| 2 |
namespace PixelavoOpt\Admin; |
| 3 |
|
| 4 |
class Options_Field { |
| 5 |
|
| 6 |
private $woocommerce_check = []; |
| 7 |
private $event_list_desc = 'Select pixel events from the list below.'; |
| 8 |
|
| 9 |
/** |
| 10 |
* [$_instance] |
| 11 |
* @var null |
| 12 |
*/ |
| 13 |
private static $_instance = null; |
| 14 |
|
| 15 |
/** |
| 16 |
* [instance] Initializes a singleton instance |
| 17 |
* @return [Admin] |
| 18 |
*/ |
| 19 |
public static function instance() { |
| 20 |
if ( is_null( self::$_instance ) ) { |
| 21 |
self::$_instance = new self(); |
| 22 |
} |
| 23 |
return self::$_instance; |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
function __construct(){ |
| 28 |
$this->woocommerce_check = [ |
| 29 |
"install" => pixelavo_is_woocommerce_install(), |
| 30 |
"active" => pixelavo_is_woocommerce_active() |
| 31 |
]; |
| 32 |
if(!$this->woocommerce_check['active']) { |
| 33 |
$this->event_list_desc = 'The below events require the "WooCommerce" plugin to be active. Please Make sure that WooCommerce has been installed and Activated.'; |
| 34 |
} |
| 35 |
if(!$this->woocommerce_check['install']) { |
| 36 |
$this->event_list_desc = 'The below events require the "WooCommerce" plugin to be active. Please Make sure that WooCommerce has been installed and Activated.'; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
public function get_settings_tabs(){ |
| 41 |
|
| 42 |
$list_svg = PIXELAVO_PATH . '/assets/images/icons/list.svg'; |
| 43 |
$woocommerce_svg = PIXELAVO_PATH . '/assets/images/icons/woocommerce.svg'; |
| 44 |
$puzzle_svg = PIXELAVO_PATH . '/assets/images/icons/puzzle.svg'; |
| 45 |
$slider_svg = PIXELAVO_PATH . '/assets/images/icons/slider.svg'; |
| 46 |
if(file_exists($list_svg)) { |
| 47 |
$list_icon = file_get_contents($list_svg); |
| 48 |
} |
| 49 |
if(file_exists($woocommerce_svg)) { |
| 50 |
$woocommerce_icon = file_get_contents($woocommerce_svg); |
| 51 |
} |
| 52 |
if(file_exists($puzzle_svg)) { |
| 53 |
$puzzle_icon = file_get_contents($puzzle_svg); |
| 54 |
} |
| 55 |
if(file_exists($slider_svg)) { |
| 56 |
$slider_icon = file_get_contents($slider_svg); |
| 57 |
} |
| 58 |
|
| 59 |
$tabs = array( |
| 60 |
'pixels' => [ |
| 61 |
'id' => 'pixelavo_pixels_list', |
| 62 |
'title' => esc_html__( 'Pixel List', 'pixelavo' ), |
| 63 |
'icon' => json_encode($list_icon), |
| 64 |
'content' => [ |
| 65 |
'extraClass' => 'pixels', |
| 66 |
'savebtn' => false, |
| 67 |
'enableall' => false, |
| 68 |
'title' => __( 'Pixels', 'pixelavo' ), |
| 69 |
'desc' => __( 'Add pixels to your site', 'pixelavo' ), |
| 70 |
'desc_class' => '', |
| 71 |
'footer' => false, |
| 72 |
], |
| 73 |
], |
| 74 |
'events' => [ |
| 75 |
'id' => 'pixelavo_events', |
| 76 |
'title' => esc_html__( 'WooCommerce Events', 'pixelavo' ), |
| 77 |
'icon' => json_encode($woocommerce_icon), |
| 78 |
'content' => [ |
| 79 |
'extraClass' => 'events', |
| 80 |
'title' => __( 'Events', 'pixelavo' ), |
| 81 |
'desc' => __( $this->event_list_desc, 'pixelavo' ), |
| 82 |
'desc_class' => !$this->woocommerce_check['install'] || !$this->woocommerce_check['active'] ? 'warning' : '', |
| 83 |
'footer' => false, |
| 84 |
], |
| 85 |
], |
| 86 |
'custom_events' => [ |
| 87 |
'id' => 'pixelavo_custom_events', |
| 88 |
'title' => esc_html__( 'Custom Events', 'pixelavo' ), |
| 89 |
'icon' => json_encode($puzzle_icon), |
| 90 |
'content' => [ |
| 91 |
'savebtn' => false, |
| 92 |
'enableall' => false, |
| 93 |
'extraClass' => 'custom_events', |
| 94 |
'title' => __( 'Custom Events', 'pixelavo' ), |
| 95 |
'desc' => __( 'Add custom events to your site', 'pixelavo' ), |
| 96 |
'desc_class' => '', |
| 97 |
'footer' => false, |
| 98 |
], |
| 99 |
], |
| 100 |
'settings' => [ |
| 101 |
'id' => 'pixelavo_settings', |
| 102 |
'title' => esc_html__( 'Settings', 'pixelavo' ), |
| 103 |
'icon' => json_encode($slider_icon), |
| 104 |
'content' => [ |
| 105 |
'enableall' => false, |
| 106 |
'extraClass' => 'settings', |
| 107 |
'title' => __( 'Advance Settings', 'pixelavo' ), |
| 108 |
'desc' => __( 'Select pixel settings from the list below.', 'pixelavo' ), |
| 109 |
'desc_class' => '', |
| 110 |
'footer' => false, |
| 111 |
], |
| 112 |
], |
| 113 |
); |
| 114 |
|
| 115 |
return apply_filters( 'pixelavo_admin_fields_sections', $tabs ); |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
public function get_settings_subtabs(){ |
| 120 |
|
| 121 |
$subtabs = array(); |
| 122 |
|
| 123 |
return apply_filters( 'pixelavo_admin_fields_sub_sections', $subtabs ); |
| 124 |
} |
| 125 |
|
| 126 |
public function get_registered_settings(){ |
| 127 |
$settings = array( |
| 128 |
'pixelavo_pixels_list' => array( |
| 129 |
array( |
| 130 |
'id' => "pixel_lists", |
| 131 |
'type' => 'table', |
| 132 |
'table_title' => esc_html__( 'Pixel List', 'pixelavo' ), |
| 133 |
'modal_open_button_text' => esc_html__( 'Add New Pixel' , 'pixelavo' ), |
| 134 |
'modal_fields' => array( |
| 135 |
array( |
| 136 |
'id' => 'pixel_name', |
| 137 |
'name' => __( 'Pixel Name', 'pixelavo' ), |
| 138 |
'desc' => __( 'This name will help you to recognize your pixel.', 'pixelavo' ), |
| 139 |
'type' => 'text', |
| 140 |
'required' => true |
| 141 |
), |
| 142 |
array( |
| 143 |
'id' => 'pixel_id', |
| 144 |
'name' => __( 'Pixel ID', 'pixelavo' ), |
| 145 |
'desc' => __( 'Enter your Facebook pixel ID here', 'pixelavo' ), |
| 146 |
'type' => 'text', |
| 147 |
'required' => true |
| 148 |
), |
| 149 |
array( |
| 150 |
'id' => 'pixel_page', |
| 151 |
'name' => __( 'Select Page', 'pixelavo' ), |
| 152 |
'desc' => __( 'Select the page type', 'pixelavo' ), |
| 153 |
'type' => 'radio', |
| 154 |
'required' => true, |
| 155 |
'radio_inputs' => array( |
| 156 |
array( |
| 157 |
'label' => esc_html__('All Pages'), |
| 158 |
'value' => "allpages", |
| 159 |
'default' => 'on', |
| 160 |
), |
| 161 |
array( |
| 162 |
'label' => esc_html__('Specific Pages'), |
| 163 |
'value' => "specificpage", |
| 164 |
) |
| 165 |
) |
| 166 |
), |
| 167 |
array( |
| 168 |
'id' => 'specificpage_list', |
| 169 |
'name' => __( 'Page Lists', 'pixelavo' ), |
| 170 |
'desc' => __( 'Select specifi pages form the list', 'pixelavo' ), |
| 171 |
'toggle' => array( |
| 172 |
'key' => 'pixel_page', |
| 173 |
'operator' => '==', |
| 174 |
'value' => 'specificpage' |
| 175 |
), |
| 176 |
'type' => 'multiselect', |
| 177 |
'default' => '0', |
| 178 |
'required' => true, |
| 179 |
'options' => pixelavo_page_list() |
| 180 |
), |
| 181 |
array( |
| 182 |
'id' => 'conversion_api_status', |
| 183 |
'name' => __( 'Conversion Api Status', 'pixelavo' ), |
| 184 |
'type' => 'element', |
| 185 |
'default' => 'off', |
| 186 |
'label_on' => __( 'On', 'pixelavo' ), |
| 187 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 188 |
), |
| 189 |
array( |
| 190 |
'id' => 'access_token', |
| 191 |
'name' => __( 'Access Token', 'pixelavo' ), |
| 192 |
'desc' => __( 'Enter access token here', 'pixelavo' ), |
| 193 |
'toggle' => array( |
| 194 |
'key' => 'conversion_api_status', |
| 195 |
'operator' => '==', |
| 196 |
'value' => 'on' |
| 197 |
), |
| 198 |
'type' => 'textarea', |
| 199 |
'required' => true |
| 200 |
), |
| 201 |
array( |
| 202 |
'id' => 'event_code', |
| 203 |
'name' => __( 'Test Event Code', 'pixelavo' ), |
| 204 |
'desc' => __( 'Enter test code here (Remove the test code after testing events)', 'pixelavo' ), |
| 205 |
'toggle' => array( |
| 206 |
'key' => 'conversion_api_status', |
| 207 |
'operator' => '==', |
| 208 |
'value' => 'on' |
| 209 |
), |
| 210 |
'type' => 'text', |
| 211 |
), |
| 212 |
), |
| 213 |
'table_column' => array( |
| 214 |
'pixel_name' => __( 'Pixel Name', 'pixelavo' ), |
| 215 |
'pixel_id' => __( 'Pixel ID', 'pixelavo' ), |
| 216 |
'status' => array( |
| 217 |
'title' => __( 'Status', 'pixelavo' ), |
| 218 |
'type' => 'switcher' |
| 219 |
), |
| 220 |
'action' => array( |
| 221 |
'title' => __( 'Action', 'pixelavo' ), |
| 222 |
'button_edit' => __( 'Edit', 'pixelavo' ), |
| 223 |
'button_delete' => __( 'Delete', 'pixelavo' ) |
| 224 |
) |
| 225 |
), |
| 226 |
'pixel_limit' => apply_filters('pixelavo_pixels_limit', 1) |
| 227 |
) |
| 228 |
), |
| 229 |
'pixelavo_events' => array( |
| 230 |
array( |
| 231 |
'id' => 'add_to_cart', |
| 232 |
'name' => __( 'Add To Cart', 'pixelavo' ), |
| 233 |
'desc' => __( 'When a product is added to the shopping cart.', 'pixelavo' ), |
| 234 |
'type' => 'switcher', |
| 235 |
'default' => apply_filters('pixelavo_pro_event_default', 'off'), |
| 236 |
'label_on' => __( 'On', 'pixelavo' ), |
| 237 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 238 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 239 |
"woocommerce" => $this->woocommerce_check['active'] |
| 240 |
), |
| 241 |
array( |
| 242 |
'id' => 'initiate_checkout', |
| 243 |
'name' => __( 'Initiate Checkout', 'pixelavo' ), |
| 244 |
'desc' => __( 'When a person enters the checkout flow prior to completing the checkout flow.', 'pixelavo' ), |
| 245 |
'type' => 'switcher', |
| 246 |
'default' => apply_filters('pixelavo_pro_event_default', 'off'), |
| 247 |
'label_on' => __( 'On', 'pixelavo' ), |
| 248 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 249 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 250 |
"woocommerce" => $this->woocommerce_check['active'] |
| 251 |
), |
| 252 |
array( |
| 253 |
'id' => 'purchase', |
| 254 |
'name' => __( 'Purchase', 'pixelavo' ), |
| 255 |
'desc' => __( 'When a purchase is made or checkout flow is completed.', 'pixelavo' ), |
| 256 |
'type' => 'switcher', |
| 257 |
'default' => apply_filters('pixelavo_pro_event_default', 'off'), |
| 258 |
'label_on' => __( 'On', 'pixelavo' ), |
| 259 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 260 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 261 |
"woocommerce" => $this->woocommerce_check['active'] |
| 262 |
), |
| 263 |
array( |
| 264 |
'id' => 'search', |
| 265 |
'name' => __( 'Search', 'pixelavo' ), |
| 266 |
'desc' => __( 'When a search is made using WordPress built-in search feature.', 'pixelavo' ), |
| 267 |
'type' => 'switcher', |
| 268 |
'default' => $this->woocommerce_check['active'] ? 'on' : 'off', |
| 269 |
'label_on' => __( 'On', 'pixelavo' ), |
| 270 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 271 |
'is_pro' => false, |
| 272 |
"woocommerce" => $this->woocommerce_check['active'] |
| 273 |
), |
| 274 |
array( |
| 275 |
'id' => 'view_content', |
| 276 |
'name' => __( 'View Content', 'pixelavo' ), |
| 277 |
'desc' => __( 'When a person visit a product details page.', 'pixelavo' ), |
| 278 |
'type' => 'switcher', |
| 279 |
'default' => $this->woocommerce_check['active'] ? 'on' : 'off', |
| 280 |
'label_on' => __( 'On', 'pixelavo' ), |
| 281 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 282 |
'is_pro' => false, |
| 283 |
"woocommerce" => $this->woocommerce_check['active'] |
| 284 |
), |
| 285 |
array( |
| 286 |
'id' => 'view_category', |
| 287 |
'name' => __( 'View Category', 'pixelavo' ), |
| 288 |
'desc' => __( 'When a person visit a product category page.', 'pixelavo' ), |
| 289 |
'type' => 'switcher', |
| 290 |
'default' => $this->woocommerce_check['active'] ? 'on' : 'off', |
| 291 |
'label_on' => __( 'On', 'pixelavo' ), |
| 292 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 293 |
'is_pro' => false, |
| 294 |
"woocommerce" => $this->woocommerce_check['active'] |
| 295 |
), |
| 296 |
array( |
| 297 |
'id' => 'customize_product', |
| 298 |
'name' => __( 'Customize Product', 'pixelavo' ), |
| 299 |
'desc' => __( 'When a person customizes a product.', 'pixelavo' ), |
| 300 |
'type' => 'switcher', |
| 301 |
'default' => apply_filters('pixelavo_pro_event_default', 'off'), |
| 302 |
'label_on' => __( 'On', 'pixelavo' ), |
| 303 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 304 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 305 |
"woocommerce" => $this->woocommerce_check['active'] |
| 306 |
) |
| 307 |
), |
| 308 |
'pixelavo_custom_events' => [ |
| 309 |
array( |
| 310 |
'id' => "custom_events_lists", |
| 311 |
'type' => 'event-table', |
| 312 |
'table_title' => esc_html__( 'Custom Event List', 'pixelavo' ), |
| 313 |
'modal_open_button_text' => esc_html__( 'Add New Event' , 'pixelavo' ), |
| 314 |
'modal_fields' => [ |
| 315 |
[ |
| 316 |
'id' => 'event_name', |
| 317 |
'name' => __( 'Event Name', 'pixelavo' ), |
| 318 |
'desc' => __( 'This name will help you to recognize your event.', 'pixelavo' ), |
| 319 |
'type' => 'text', |
| 320 |
'required' => true |
| 321 |
], |
| 322 |
[ |
| 323 |
'id' => 'event_trigger', |
| 324 |
'name' => __( 'Trigger', 'pixelavo' ), |
| 325 |
'type' => 'select', |
| 326 |
'required' => true, |
| 327 |
'default' => 0, |
| 328 |
'options' => [ |
| 329 |
[ |
| 330 |
'id' => 'page_visit', |
| 331 |
'text' => 'Page Visit' |
| 332 |
], |
| 333 |
[ |
| 334 |
'id' => 'click_on_element', |
| 335 |
'text' => apply_filters('pixelavo_pro_feature', true) ? 'Click on Element (Pro)' : 'Click on Element', |
| 336 |
'disabled' => apply_filters('pixelavo_pro_feature', true) |
| 337 |
], |
| 338 |
[ |
| 339 |
'id' => 'hover_on_element', |
| 340 |
'text' => apply_filters('pixelavo_pro_feature', true) ? 'Hover on Element (Pro)' : 'Hover on Element', |
| 341 |
'disabled' => apply_filters('pixelavo_pro_feature', true) |
| 342 |
], |
| 343 |
[ |
| 344 |
'id' => 'url_click', |
| 345 |
'text' => apply_filters('pixelavo_pro_feature', true) ? 'URL Click (Pro)' : 'URL Click', |
| 346 |
'disabled' => apply_filters('pixelavo_pro_feature', true) |
| 347 |
], |
| 348 |
] |
| 349 |
], |
| 350 |
[ |
| 351 |
'id' => 'event_trigger_page_list', |
| 352 |
'name' => __( 'Target Pages', 'pixelavo' ), |
| 353 |
'desc' => __( 'Choose where on your site to trigger this event.', 'pixelavo' ), |
| 354 |
'toggle' => [ |
| 355 |
'key' => 'event_trigger', |
| 356 |
'operator' => '==', |
| 357 |
'value' => 'page_visit' |
| 358 |
], |
| 359 |
'type' => 'multiselect', |
| 360 |
'default' => '0', |
| 361 |
'required' => true, |
| 362 |
'options' => pixelavo_page_list() |
| 363 |
], |
| 364 |
[ |
| 365 |
'id' => 'event_trigger_element', |
| 366 |
'name' => __( 'Target CSS Selector', 'pixelavo' ), |
| 367 |
'desc' => __( 'Enter the css class or id that will trigger the event on click.', 'pixelavo' ), |
| 368 |
'toggle' => [ |
| 369 |
'key' => 'event_trigger', |
| 370 |
'operator' => '==', |
| 371 |
'value' => 'click_on_element' |
| 372 |
], |
| 373 |
'type' => 'text', |
| 374 |
'placeholder' => '#element-id', |
| 375 |
'required' => true, |
| 376 |
], |
| 377 |
[ |
| 378 |
'id' => 'event_trigger_hover', |
| 379 |
'name' => __( 'Target CSS Selector', 'pixelavo' ), |
| 380 |
'desc' => __( 'Enter the css class or id that will trigger the event on hover.', 'pixelavo' ), |
| 381 |
'toggle' => [ |
| 382 |
'key' => 'event_trigger', |
| 383 |
'operator' => '==', |
| 384 |
'value' => 'hover_on_element' |
| 385 |
], |
| 386 |
'type' => 'text', |
| 387 |
'placeholder' => '#element-id', |
| 388 |
'required' => true, |
| 389 |
], |
| 390 |
[ |
| 391 |
'id' => 'event_trigger_url', |
| 392 |
'name' => __( 'Target URL', 'pixelavo' ), |
| 393 |
'desc' => __( 'Enter the url that will trigger the event on click.', 'pixelavo' ), |
| 394 |
'toggle' => [ |
| 395 |
'key' => 'event_trigger', |
| 396 |
'operator' => '==', |
| 397 |
'value' => 'url_click' |
| 398 |
], |
| 399 |
'type' => 'text', |
| 400 |
'placeholder' => 'https://hasthemes.com', |
| 401 |
'required' => true, |
| 402 |
], |
| 403 |
[ |
| 404 |
'id' => 'event_params', |
| 405 |
'name' => __( 'Parameters', 'pixelavo' ), |
| 406 |
'desc' => __( 'Add custom parameters here.', 'pixelavo' ), |
| 407 |
'type' => 'repeater', |
| 408 |
'fields' => ['name', 'value'] |
| 409 |
], |
| 410 |
], |
| 411 |
'table_column' => [ |
| 412 |
'event_name' => __( 'Event', 'pixelavo' ), |
| 413 |
'event_trigger' => __( 'Trigger', 'pixelavo' ), |
| 414 |
'action' => __( 'Action', 'pixelavo' ) |
| 415 |
], |
| 416 |
'custom_event_limit' => apply_filters('pixelavo_custom_event_limit', 1) |
| 417 |
) |
| 418 |
], |
| 419 |
'pixelavo_settings' => array( |
| 420 |
array( |
| 421 |
'id' => 'exclude_roles', |
| 422 |
'name' => __( 'Exclude Roles', 'pixelavo' ), |
| 423 |
'desc' => __( 'Users who are logged in and have roles selected here will not trigger your pixel events.', 'pixelavo' ), |
| 424 |
'type' => 'multiselect', |
| 425 |
'options' => pixelavo_editable_roles(), |
| 426 |
), |
| 427 |
array( |
| 428 |
'id' => 'product_feed', |
| 429 |
'name' => __( 'Product Feed.', 'pixelavo' ), |
| 430 |
'desc' => __( 'A Product Feed is required to use Facebook Dynamic Product Ads.', 'pixelavo' ), |
| 431 |
'type' => 'switcher', |
| 432 |
'default' => 'off', |
| 433 |
'label_on' => __( 'On', 'pixelavo' ), |
| 434 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 435 |
"woocommerce" => $this->woocommerce_check['active'] |
| 436 |
), |
| 437 |
array( |
| 438 |
'id' => 'include_variations', |
| 439 |
'name' => __( 'Include Variations', 'pixelavo' ), |
| 440 |
'desc' => __( 'Having a lot of product variations can cause load issues with your feed, disable to exclude variations from the feed.', 'pixelavo' ), |
| 441 |
'type' => 'switcher', |
| 442 |
'default' => 'on', |
| 443 |
'label_on' => __( 'On', 'pixelavo' ), |
| 444 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 445 |
'toggle' => array( |
| 446 |
'key' => 'product_feed', |
| 447 |
'operator' => '==', |
| 448 |
'value' => 'on' |
| 449 |
), |
| 450 |
), |
| 451 |
array( |
| 452 |
'id' => 'product_feed_url', |
| 453 |
'name' => __( 'Feed Url', 'pixelavo' ), |
| 454 |
'desc' => __( 'You\'ll need above URL when setting up your Facebook Product Catalog.', 'pixelavo' ), |
| 455 |
'type' => 'text', |
| 456 |
'default' => get_site_url() . '?feed=pixelavo', |
| 457 |
'readonly' => true, |
| 458 |
'toggle' => array( |
| 459 |
'key' => 'product_feed', |
| 460 |
'operator' => '==', |
| 461 |
'value' => 'on' |
| 462 |
), |
| 463 |
), |
| 464 |
array( |
| 465 |
'id' => 'exclude_categories', |
| 466 |
'name' => __( 'Exclude Categories', 'pixelavo' ), |
| 467 |
'desc' => __( 'Selected product categories will not be included in your feed.', 'pixelavo' ), |
| 468 |
'type' => 'multiselect', |
| 469 |
'options' => get_product_categories(), |
| 470 |
'toggle' => array( |
| 471 |
'key' => 'product_feed', |
| 472 |
'operator' => '==', |
| 473 |
'value' => 'on' |
| 474 |
), |
| 475 |
), |
| 476 |
array( |
| 477 |
'id' => 'exclude_tags', |
| 478 |
'name' => __( 'Exclude Tags', 'pixelavo' ), |
| 479 |
'desc' => __( 'Selected product tags will not be included in your feed.', 'pixelavo' ), |
| 480 |
'type' => 'multiselect', |
| 481 |
'options' => get_product_tags(), |
| 482 |
'toggle' => array( |
| 483 |
'key' => 'product_feed', |
| 484 |
'operator' => '==', |
| 485 |
'value' => 'on' |
| 486 |
), |
| 487 |
), |
| 488 |
array( |
| 489 |
'id' => 'product_identifier', |
| 490 |
'name' => __( 'Product Identifier', 'pixelavo' ), |
| 491 |
'desc' => __( 'Set how to identify your product using the Facebook Pixel (content_id) and the feed (g:id). Please make sure to have SKUs set on your products if you choose WooCommerce SKU.', 'pixelavo' ), |
| 492 |
'type' => 'select', |
| 493 |
'options' => [ |
| 494 |
[ |
| 495 |
'id' => 'post_id', |
| 496 |
'text' => 'WordPress Post ID (recommended)' |
| 497 |
], |
| 498 |
[ |
| 499 |
'id' => 'sku', |
| 500 |
'text' => 'WooCommerce SKU' |
| 501 |
] |
| 502 |
], |
| 503 |
'default' => 'post_id', |
| 504 |
'toggle' => array( |
| 505 |
'key' => 'product_feed', |
| 506 |
'operator' => '==', |
| 507 |
'value' => 'on' |
| 508 |
), |
| 509 |
), |
| 510 |
array( |
| 511 |
'id' => 'description_field', |
| 512 |
'name' => __( 'Description Field', 'pixelavo' ), |
| 513 |
'desc' => __( 'Set the field to use as your product description for the Facebook product catalog.', 'pixelavo' ), |
| 514 |
'type' => 'select', |
| 515 |
'options' => [ |
| 516 |
[ |
| 517 |
'id' => 'description', |
| 518 |
'text' => 'Product Content' |
| 519 |
], |
| 520 |
[ |
| 521 |
'id' => 'short', |
| 522 |
'text' => 'Product Short Description' |
| 523 |
] |
| 524 |
], |
| 525 |
'default' => 'description', |
| 526 |
'toggle' => array( |
| 527 |
'key' => 'product_feed', |
| 528 |
'operator' => '==', |
| 529 |
'value' => 'on' |
| 530 |
), |
| 531 |
), |
| 532 |
array( |
| 533 |
'id' => 'view_content_delay', |
| 534 |
'name' => __( 'View Content Event Delay', 'pixelavo' ), |
| 535 |
'desc' => __( 'To exclude bouncing visitors from triggering the ViewContent event on product page, introduce a delay, which will be in second. Default is 0 second', 'pixelavo' ), |
| 536 |
'type' => 'text', |
| 537 |
'default' => 0, |
| 538 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 539 |
"woocommerce" => $this->woocommerce_check['active'] |
| 540 |
), |
| 541 |
array( |
| 542 |
'id' => 'purchase_event_trigger', |
| 543 |
'name' => __( 'Purchase Event Trigger.', 'pixelavo' ), |
| 544 |
'desc' => __( 'You can select the timing to initiate the <b>"Purchase"</b> event. By default, it occurs when the order status is <b>"On Hold"</b> or <b>"Processing"</b>.', 'pixelavo' ), |
| 545 |
'type' => 'multiselect', |
| 546 |
'required' => true, |
| 547 |
'default' => ['on_hold', 'processing'], |
| 548 |
'options' => array( |
| 549 |
array( |
| 550 |
'id' => "on-hold", |
| 551 |
'text' => __('On Hold', 'pixelavo' ), |
| 552 |
), |
| 553 |
array( |
| 554 |
'id' => "processing", |
| 555 |
'text' => __('Processing', 'pixelavo' ), |
| 556 |
) |
| 557 |
), |
| 558 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 559 |
"woocommerce" => $this->woocommerce_check['active'] |
| 560 |
), |
| 561 |
array( |
| 562 |
'id' => 'purchase_additional_info', |
| 563 |
'name' => __( 'Include additional information with the Purchase event.', 'pixelavo' ), |
| 564 |
'desc' => __( 'The Purchase event includes coupon codes (if applied) and shipping information as parameters, allowing you to create more precise and effective custom audiences.', 'pixelavo' ), |
| 565 |
'type' => 'switcher', |
| 566 |
'default' => 'off', |
| 567 |
'label_on' => __( 'On', 'pixelavo' ), |
| 568 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 569 |
'is_pro' => apply_filters('pixelavo_pro_feature', true), |
| 570 |
"woocommerce" => $this->woocommerce_check['active'] |
| 571 |
), |
| 572 |
array( |
| 573 |
'id' => 'additional_user_info', |
| 574 |
'name' => __( 'Additional user information.', 'pixelavo' ), |
| 575 |
'desc' => __( 'Include HTTP referrer, user language, post categories, and tags as event parameters, allowing you to build more precise custom audiences.', 'pixelavo' ), |
| 576 |
'type' => 'switcher', |
| 577 |
'default' => 'off', |
| 578 |
'label_on' => __( 'On', 'pixelavo' ), |
| 579 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 580 |
'is_pro' => apply_filters('pixelavo_pro_feature', true) |
| 581 |
), |
| 582 |
array( |
| 583 |
'id' => 'advanced_matching', |
| 584 |
'name' => __( 'Advanced Matching.', 'pixelavo' ), |
| 585 |
'desc' => __( 'Enable Advanced Matching for all events. According to Facebook, advanced matching has assisted businesses in increasing attributed conversions by 10% and campaign reach by 20% through retargeting.', 'pixelavo' ), |
| 586 |
'type' => 'switcher', |
| 587 |
'default' => 'off', |
| 588 |
'label_on' => __( 'On', 'pixelavo' ), |
| 589 |
'label_off' => __( 'Off', 'pixelavo' ), |
| 590 |
'is_pro' => apply_filters('pixelavo_pro_feature', true) |
| 591 |
) |
| 592 |
) |
| 593 |
); |
| 594 |
|
| 595 |
return apply_filters( 'pixelavo_admin_fields', $settings ); |
| 596 |
|
| 597 |
} |
| 598 |
|
| 599 |
} |