PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) - Version 5.0.2

Version Description

Download this release

Release Info

Developer PixelYourSite
Plugin Icon 128x128 PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads)
Version 5.0.2
Comparing to
See all releases

Code changes from version 5.0.1 to 5.0.2

facebook-pixel-master.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
- Version: 5.0.1
9
  License: GPLv3
10
  */
11
 
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  exit; // Exit if accessed directly.
14
  }
15
 
16
- define( 'PYS_FREE_VERSION', '5.0.1' );
17
 
18
  require_once( 'inc/admin_notices.php' );
19
  require_once( 'inc/common.php' );
@@ -21,6 +21,7 @@ require_once( 'inc/common-edd.php' );
21
  require_once( 'inc/core.php' );
22
  require_once( 'inc/core-edd.php' );
23
  require_once( 'inc/ajax-standard.php' );
 
24
 
25
  add_action( 'plugins_loaded', 'pys_free_init' );
26
  function pys_free_init() {
5
  Plugin URI: http://www.pixelyoursite.com/facebook-pixel-plugin-help
6
  Author: PixelYourSite
7
  Author URI: http://www.pixelyoursite.com
8
+ Version: 5.0.2
9
  License: GPLv3
10
  */
11
 
13
  exit; // Exit if accessed directly.
14
  }
15
 
16
+ define( 'PYS_FREE_VERSION', '5.0.2' );
17
 
18
  require_once( 'inc/admin_notices.php' );
19
  require_once( 'inc/common.php' );
21
  require_once( 'inc/core.php' );
22
  require_once( 'inc/core-edd.php' );
23
  require_once( 'inc/ajax-standard.php' );
24
+ require_once( 'inc/integrations/facebook-for-woocommerce.php' );
25
 
26
  add_action( 'plugins_loaded', 'pys_free_init' );
27
  function pys_free_init() {
inc/ajax-standard.php CHANGED
@@ -36,6 +36,7 @@ if ( ! function_exists( 'pys_edit_std_event' ) ) {
36
  'content_type' => null,
37
  'content_category' => null,
38
  'num_items' => null,
 
39
  'search_string' => null,
40
  'status' => null,
41
  'code' => null,
36
  'content_type' => null,
37
  'content_category' => null,
38
  'num_items' => null,
39
+ 'order_id' => null,
40
  'search_string' => null,
41
  'status' => null,
42
  'code' => null,
inc/common.php CHANGED
@@ -430,20 +430,17 @@ if ( ! function_exists( 'pys_get_product_content_id' ) ) {
430
  * Return product id or sku.
431
  */
432
  function pys_get_product_content_id( $product_id ) {
433
- // global $wpdb;
434
 
435
- if ( pys_get_option( 'woo', 'content_id' ) == 'sku' ) {
436
-
437
- $sku = get_post_meta( $product_id, '_sku', true );
438
-
439
- return '"' . $sku . '"';
440
 
 
 
441
  } else {
442
-
443
- return $product_id;
444
-
445
  }
446
 
 
 
447
  }
448
 
449
  }
@@ -1152,7 +1149,7 @@ if( !function_exists( 'pys_get_default_options' ) ) {
1152
  $options['edd']['purchase_add_payment_method'] = true;
1153
  $options['edd']['purchase_add_coupons'] = true;
1154
 
1155
- return $options;
1156
 
1157
  }
1158
 
430
  * Return product id or sku.
431
  */
432
  function pys_get_product_content_id( $product_id ) {
 
433
 
434
+ $content_id_format = pys_get_option( 'woo', 'content_id_format', 'default' );
 
 
 
 
435
 
436
+ if ( pys_get_option( 'woo', 'content_id' ) == 'sku' ) {
437
+ $content_id = get_post_meta( $product_id, '_sku', true );
438
  } else {
439
+ $content_id = $product_id;
 
 
440
  }
441
 
442
+ return apply_filters( 'pys_fb_pixel_woo_product_content_id', $content_id, $product_id, $content_id_format );
443
+
444
  }
445
 
446
  }
1149
  $options['edd']['purchase_add_payment_method'] = true;
1150
  $options['edd']['purchase_add_coupons'] = true;
1151
 
1152
+ return apply_filters( 'pys_fb_pixel_setting_defaults', $options );
1153
 
1154
  }
1155
 
inc/core.php CHANGED
@@ -4,160 +4,230 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- if( !function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
8
-
9
  function pys_get_woo_ajax_addtocart_params( $product_id ) {
10
-
11
  $params = array();
12
  $params['content_type'] = 'product';
13
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
14
-
15
  // currency, value
16
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
17
-
18
- $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  $params['currency'] = get_woocommerce_currency();
20
-
21
  }
22
-
23
  return $params;
24
-
25
  }
26
-
27
  }
28
 
29
- if( !function_exists( 'pys_get_post_tags' ) ) {
30
-
31
  /**
32
  * Return array of product tags.
33
  * PRO only.
34
  */
35
  function pys_get_post_tags( $post_id ) {
36
-
37
  return array(); // PRO feature
38
-
39
  }
40
-
41
  }
42
 
43
- if( !function_exists( 'pys_get_woo_code' ) ) {
44
-
45
  /**
46
  * Build WooCommerce related events code.
47
  * Function adds evaluated event params to global array.
48
  */
49
  function pys_get_woo_code() {
50
  global $post, $woocommerce;
51
-
52
  // set defaults params
53
- $params = array();
54
  $params['content_type'] = 'product';
55
-
56
  // ViewContent Event
57
- if( pys_get_option( 'woo', 'on_view_content' ) && is_product() ) {
58
-
59
- $params['content_ids'] = '[' . pys_get_product_content_id( $post->ID ) . ']';
60
-
61
  // currency, value
62
  if ( pys_get_option( 'woo', 'enable_view_content_value' ) ) {
63
-
64
- $params['value'] = pys_get_option( 'woo', 'view_content_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  $params['currency'] = get_woocommerce_currency();
66
-
67
  }
68
-
69
  pys_add_event( 'ViewContent', $params );
70
-
71
  return;
72
-
73
  }
74
-
75
  // AddToCart Cart Page Event
76
  if ( pys_get_option( 'woo', 'on_cart_page' ) && is_cart() ) {
77
-
78
  $ids = array(); // cart items ids or sku
79
-
80
- foreach( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
81
-
82
  $product_id = pys_get_product_id( $item );
83
  $value = pys_get_product_content_id( $product_id );
84
  $ids[] = $value;
85
-
86
  }
87
-
88
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
89
-
90
  // currency, value
91
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
92
-
93
- $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  $params['currency'] = get_woocommerce_currency();
95
-
96
  }
97
-
98
  pys_add_event( 'AddToCart', $params );
99
-
100
  return;
101
-
102
  }
103
-
104
  // Checkout Page Event
105
  if ( pys_get_option( 'woo', 'on_checkout_page' ) && is_checkout() && ! is_wc_endpoint_url() ) {
106
-
107
  $params = pys_get_woo_checkout_params( false );
108
-
109
  // currency, value
110
  if ( pys_get_option( 'woo', 'enable_checkout_value' ) ) {
111
-
112
- $params['value'] = pys_get_option( 'woo', 'checkout_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  $params['currency'] = get_woocommerce_currency();
114
-
115
  }
116
-
117
  pys_add_event( 'InitiateCheckout', $params );
118
-
119
  return;
120
-
121
  }
122
-
123
  // Purchase Event
124
  if ( pys_get_option( 'woo', 'on_thank_you_page' ) && is_wc_endpoint_url( 'order-received' ) ) {
125
-
126
  $order_id = wc_get_order_id_by_order_key( $_REQUEST['key'] );
127
  $order = new WC_Order( $order_id );
128
  $items = $order->get_items( 'line_item' );
129
-
130
  $ids = array(); // order items ids or sku
131
-
132
- foreach( $items as $item ) {
133
-
134
  $product_id = pys_get_product_id( $item );
135
  $value = pys_get_product_content_id( $product_id );
136
  $ids[] = $value;
137
-
138
  }
139
-
140
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
141
-
142
  // currency, value
143
  if ( pys_get_option( 'woo', 'enable_purchase_value' ) ) {
144
-
145
- $params['value'] = pys_get_option( 'woo', 'purchase_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  $params['currency'] = get_woocommerce_currency();
147
-
148
  }
149
-
150
  pys_add_event( 'Purchase', $params );
151
-
152
  return;
153
-
154
  }
155
-
156
  }
157
-
158
  }
159
 
160
- if( !function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
161
 
162
  /**
163
  * Adds data-pixelcode attribute to "add to cart" buttons in the WooCommerce loop.
@@ -174,22 +244,22 @@ if( !function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
174
  if ( 'yes' !== get_option( 'woocommerce_enable_ajax_add_to_cart' ) ) {
175
  return $tag;
176
  }
177
-
178
  /**
179
  * @since 5.0.1
180
  */
181
- if( pys_is_wc_version_gte( '2.7' ) ) {
182
  $is_simple_product = $product->is_type( 'simple' );
183
  } else {
184
  $is_simple_product = $product->product_type == 'simple';
185
  }
186
-
187
  if ( false == $is_simple_product ) {
188
  return $tag;
189
  }
190
-
191
  $event_id = uniqid();
192
-
193
  /**
194
  * @since 5.0.1
195
  */
@@ -198,35 +268,50 @@ if( !function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
198
  } else {
199
  $product_id = $product->post->ID;
200
  }
201
-
202
  // common params
203
  $params = array();
204
  $params['content_type'] = 'product';
205
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
206
-
207
  // currency, value
208
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
209
-
210
- $params['value'] = pys_get_option( 'woo', 'add_to_cart_global_value' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  $params['currency'] = get_woocommerce_currency();
212
-
213
  }
214
-
215
  $tag = pys_insert_attribute( 'data-pys-event-id', $event_id, $tag, true, 'any' );
216
-
217
  $pys_woo_ajax_events[ $event_id ] = array(
218
  'name' => 'AddToCart',
219
  'params' => $params
220
  );
221
-
222
  return $tag;
223
-
224
  }
225
-
226
  }
227
 
228
- if( !function_exists( 'pys_get_additional_matching_code' ) ) {
229
-
230
  /**
231
  * Adds extra params to pixel init code. On Free always returns empty string.
232
  * PRO only.
@@ -238,28 +323,28 @@ if( !function_exists( 'pys_get_additional_matching_code' ) ) {
238
  * @return string
239
  */
240
  function pys_get_additional_matching_code() {
241
-
242
  return ''; // PRO feature
243
-
244
  }
245
-
246
  }
247
 
248
- if( !function_exists( 'pys_get_additional_woo_params' ) ) {
249
-
250
  /**
251
  * Adds additional post parameters like `content_name` and `category_name`.
252
  * PRO only.
253
  *
254
- * @param $post WP_Post|int
255
  * @param $params array reference to $params array
256
  */
257
  function pys_get_additional_woo_params( $post, &$params ) {
258
-
259
  // PRO only
260
-
261
  }
262
-
263
  }
264
 
265
  if ( ! function_exists( 'pys_general_woo_event' ) ) {
@@ -292,4 +377,79 @@ if ( ! function_exists( 'pys_general_edd_event' ) ) {
292
  // PRO feature
293
  }
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ if ( ! function_exists( 'pys_get_woo_ajax_addtocart_params' ) ) {
8
+
9
  function pys_get_woo_ajax_addtocart_params( $product_id ) {
10
+
11
  $params = array();
12
  $params['content_type'] = 'product';
13
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
14
+
15
  // currency, value
16
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
17
+
18
+ $option = pys_get_option( 'woo', 'add_to_cart_value_option' );
19
+ switch ( $option ) {
20
+ case 'global':
21
+ $value = pys_get_option( 'woo', 'add_to_cart_global_value' );
22
+ break;
23
+
24
+ case 'price':
25
+ $value = pys_get_product_price( $product_id );
26
+ break;
27
+
28
+ default:
29
+ $value = null;
30
+ }
31
+
32
+ $params['value'] = $value;
33
  $params['currency'] = get_woocommerce_currency();
34
+
35
  }
36
+
37
  return $params;
38
+
39
  }
40
+
41
  }
42
 
43
+ if ( ! function_exists( 'pys_get_post_tags' ) ) {
44
+
45
  /**
46
  * Return array of product tags.
47
  * PRO only.
48
  */
49
  function pys_get_post_tags( $post_id ) {
50
+
51
  return array(); // PRO feature
52
+
53
  }
54
+
55
  }
56
 
57
+ if ( ! function_exists( 'pys_get_woo_code' ) ) {
58
+
59
  /**
60
  * Build WooCommerce related events code.
61
  * Function adds evaluated event params to global array.
62
  */
63
  function pys_get_woo_code() {
64
  global $post, $woocommerce;
65
+
66
  // set defaults params
67
+ $params = array();
68
  $params['content_type'] = 'product';
69
+
70
  // ViewContent Event
71
+ if ( pys_get_option( 'woo', 'on_view_content' ) && is_product() ) {
72
+
73
+ $params['content_ids'] = '[' . pys_get_product_content_id( $post->ID ) . ']';
74
+
75
  // currency, value
76
  if ( pys_get_option( 'woo', 'enable_view_content_value' ) ) {
77
+
78
+ $option = pys_get_option( 'woo', 'view_content_value_option' );
79
+ switch ( $option ) {
80
+ case 'global':
81
+ $value = pys_get_option( 'woo', 'view_content_global_value' );
82
+ break;
83
+
84
+ case 'price':
85
+ $value = pys_get_product_price( $post );
86
+ break;
87
+
88
+ default:
89
+ $value = null;
90
+ }
91
+
92
+ $params['value'] = $value;
93
  $params['currency'] = get_woocommerce_currency();
94
+
95
  }
96
+
97
  pys_add_event( 'ViewContent', $params );
98
+
99
  return;
100
+
101
  }
102
+
103
  // AddToCart Cart Page Event
104
  if ( pys_get_option( 'woo', 'on_cart_page' ) && is_cart() ) {
105
+
106
  $ids = array(); // cart items ids or sku
107
+
108
+ foreach ( $woocommerce->cart->cart_contents as $cart_item_key => $item ) {
109
+
110
  $product_id = pys_get_product_id( $item );
111
  $value = pys_get_product_content_id( $product_id );
112
  $ids[] = $value;
113
+
114
  }
115
+
116
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
117
+
118
  // currency, value
119
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
120
+
121
+ $option = pys_get_option( 'woo', 'add_to_cart_value_option' );
122
+ switch ( $option ) {
123
+ case 'global':
124
+ $value = pys_get_option( 'woo', 'add_to_cart_global_value' );
125
+ break;
126
+
127
+ case 'price':
128
+ $value = pys_get_cart_total();
129
+ break;
130
+
131
+ default:
132
+ $value = null;
133
+ }
134
+
135
+ $params['value'] = $value;
136
  $params['currency'] = get_woocommerce_currency();
137
+
138
  }
139
+
140
  pys_add_event( 'AddToCart', $params );
141
+
142
  return;
143
+
144
  }
145
+
146
  // Checkout Page Event
147
  if ( pys_get_option( 'woo', 'on_checkout_page' ) && is_checkout() && ! is_wc_endpoint_url() ) {
148
+
149
  $params = pys_get_woo_checkout_params( false );
150
+
151
  // currency, value
152
  if ( pys_get_option( 'woo', 'enable_checkout_value' ) ) {
153
+
154
+ $option = pys_get_option( 'woo', 'checkout_value_option' );
155
+ switch ( $option ) {
156
+ case 'global':
157
+ $value = pys_get_option( 'woo', 'checkout_global_value' );
158
+ break;
159
+
160
+ case 'price':
161
+ $value = pys_get_cart_total();
162
+ break;
163
+
164
+ default:
165
+ $value = null;
166
+ }
167
+
168
+ $params['value'] = $value;
169
  $params['currency'] = get_woocommerce_currency();
170
+
171
  }
172
+
173
  pys_add_event( 'InitiateCheckout', $params );
174
+
175
  return;
176
+
177
  }
178
+
179
  // Purchase Event
180
  if ( pys_get_option( 'woo', 'on_thank_you_page' ) && is_wc_endpoint_url( 'order-received' ) ) {
181
+
182
  $order_id = wc_get_order_id_by_order_key( $_REQUEST['key'] );
183
  $order = new WC_Order( $order_id );
184
  $items = $order->get_items( 'line_item' );
185
+
186
  $ids = array(); // order items ids or sku
187
+
188
+ foreach ( $items as $item ) {
189
+
190
  $product_id = pys_get_product_id( $item );
191
  $value = pys_get_product_content_id( $product_id );
192
  $ids[] = $value;
193
+
194
  }
195
+
196
  $params['content_ids'] = '[' . implode( ',', $ids ) . ']';
197
+
198
  // currency, value
199
  if ( pys_get_option( 'woo', 'enable_purchase_value' ) ) {
200
+
201
+ $option = pys_get_option( 'woo', 'purchase_value_option' );
202
+ switch ( $option ) {
203
+ case 'global':
204
+ $value = pys_get_option( 'woo', 'purchase_global_value' );
205
+ break;
206
+
207
+ case 'total':
208
+ $value = pys_get_order_total( $order );
209
+ break;
210
+
211
+ default:
212
+ $value = null;
213
+ }
214
+
215
+ $params['value'] = $value;
216
  $params['currency'] = get_woocommerce_currency();
217
+
218
  }
219
+
220
  pys_add_event( 'Purchase', $params );
221
+
222
  return;
223
+
224
  }
225
+
226
  }
227
+
228
  }
229
 
230
+ if ( ! function_exists( 'pys_add_code_to_woo_cart_link' ) ) {
231
 
232
  /**
233
  * Adds data-pixelcode attribute to "add to cart" buttons in the WooCommerce loop.
244
  if ( 'yes' !== get_option( 'woocommerce_enable_ajax_add_to_cart' ) ) {
245
  return $tag;
246
  }
247
+
248
  /**
249
  * @since 5.0.1
250
  */
251
+ if ( pys_is_wc_version_gte( '2.7' ) ) {
252
  $is_simple_product = $product->is_type( 'simple' );
253
  } else {
254
  $is_simple_product = $product->product_type == 'simple';
255
  }
256
+
257
  if ( false == $is_simple_product ) {
258
  return $tag;
259
  }
260
+
261
  $event_id = uniqid();
262
+
263
  /**
264
  * @since 5.0.1
265
  */
268
  } else {
269
  $product_id = $product->post->ID;
270
  }
271
+
272
  // common params
273
  $params = array();
274
  $params['content_type'] = 'product';
275
  $params['content_ids'] = '[' . pys_get_product_content_id( $product_id ) . ']';
276
+
277
  // currency, value
278
  if ( pys_get_option( 'woo', 'enable_add_to_cart_value' ) ) {
279
+
280
+ $option = pys_get_option( 'woo', 'view_content_value_option' );
281
+ switch ( $option ) {
282
+ case 'global':
283
+ $value = pys_get_option( 'woo', 'view_content_global_value' );
284
+ break;
285
+
286
+ case 'price':
287
+ $value = pys_get_product_price( $product_id );
288
+ break;
289
+
290
+ default:
291
+ $value = null;
292
+
293
+ }
294
+
295
+ $params['value'] = $value;
296
  $params['currency'] = get_woocommerce_currency();
297
+
298
  }
299
+
300
  $tag = pys_insert_attribute( 'data-pys-event-id', $event_id, $tag, true, 'any' );
301
+
302
  $pys_woo_ajax_events[ $event_id ] = array(
303
  'name' => 'AddToCart',
304
  'params' => $params
305
  );
306
+
307
  return $tag;
308
+
309
  }
310
+
311
  }
312
 
313
+ if ( ! function_exists( 'pys_get_additional_matching_code' ) ) {
314
+
315
  /**
316
  * Adds extra params to pixel init code. On Free always returns empty string.
317
  * PRO only.
323
  * @return string
324
  */
325
  function pys_get_additional_matching_code() {
326
+
327
  return ''; // PRO feature
328
+
329
  }
330
+
331
  }
332
 
333
+ if ( ! function_exists( 'pys_get_additional_woo_params' ) ) {
334
+
335
  /**
336
  * Adds additional post parameters like `content_name` and `category_name`.
337
  * PRO only.
338
  *
339
+ * @param $post WP_Post|int
340
  * @param $params array reference to $params array
341
  */
342
  function pys_get_additional_woo_params( $post, &$params ) {
343
+
344
  // PRO only
345
+
346
  }
347
+
348
  }
349
 
350
  if ( ! function_exists( 'pys_general_woo_event' ) ) {
377
  // PRO feature
378
  }
379
 
380
+ }
381
+
382
+ if ( ! function_exists( 'pys_get_product_price' ) ) {
383
+
384
+ /**
385
+ * Return product price depends on plugin, product and WooCommerce settings.
386
+ *
387
+ * @param $product_id
388
+ *
389
+ * @return null|int Product price
390
+ */
391
+ function pys_get_product_price( $product_id ) {
392
+
393
+ $product = wc_get_product( $product_id );
394
+
395
+ /**
396
+ * @since 5.0.9
397
+ */
398
+ if ( false == $product instanceof WC_Product ) {
399
+ return 0;
400
+ }
401
+
402
+ if ( $product->is_taxable() ) {
403
+
404
+ /**
405
+ * @since 5.0.8
406
+ */
407
+ if ( pys_is_wc_version_gte( '2.7' ) ) {
408
+ $value = wc_get_price_including_tax( $product, $product->get_price() );
409
+ } else {
410
+ $value = $product->get_price_including_tax( 1, $product->get_price() );
411
+ }
412
+
413
+ } else {
414
+
415
+ /**
416
+ * @since 5.0.8
417
+ */
418
+ if ( pys_is_wc_version_gte( '2.7' ) ) {
419
+ $value = wc_get_price_excluding_tax( $product, $product->get_price() );
420
+ } else {
421
+ $value = $product->get_price_excluding_tax( 1, $product->get_price() );
422
+ }
423
+
424
+ }
425
+
426
+ return $value;
427
+
428
+ }
429
+
430
+ }
431
+
432
+ if ( ! function_exists( 'pys_get_cart_total' ) ) {
433
+
434
+ function pys_get_cart_total() {
435
+ global $woocommerce;
436
+
437
+ return $woocommerce->cart->subtotal;
438
+
439
+ }
440
+
441
+ }
442
+
443
+ if ( ! function_exists( 'pys_get_order_total' ) ) {
444
+
445
+ /**
446
+ * Calculates order 'value' param depends on WooCommerce and PYS settings
447
+ */
448
+ function pys_get_order_total( $order ) {
449
+
450
+ //wc_get_price_thousand_separator is ignored
451
+ return number_format( $total = $order->get_total(), wc_get_price_decimals(), '.', '' );
452
+
453
+ }
454
+
455
  }
inc/html-tab-woo-general.php CHANGED
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
 
14
  <hr>
15
  <h2 class="section-title">Facebook Dynamic Product Ads Pixel Settings</h2>
16
- <table class="layout">
17
  <tr class="tall">
18
  <td colspan="2" class="narrow">
19
  <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong>
@@ -21,7 +21,9 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  </td>
22
  </tr>
23
 
24
- <tr>
 
 
25
  <td class="alignright"><p class="label">content_ids:</p></td>
26
  <td>
27
  <select name="pys[woo][content_id]">
@@ -31,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  </td>
32
  </tr>
33
 
34
- <tr>
35
  <td class="alignright"><p class="label">Define Variation ID:</p></td>
36
  <td>
37
  <select name="pys[woo][variation_id]">
@@ -126,11 +128,12 @@ if ( ! defined( 'ABSPATH' ) ) {
126
  <td class="alignright"><p class="label big">Define value:</p></td>
127
  <td></td>
128
  </tr>
129
-
130
- <tr class="disabled">
131
- <td class="alignright"><p class="label">Product price</p></td>
132
  <td>
133
- <input type="radio">
 
134
  </td>
135
  </tr>
136
 
@@ -141,12 +144,13 @@ if ( ! defined( 'ABSPATH' ) ) {
141
  <input type="text">%
142
  </td>
143
  </tr>
144
-
145
  <tr>
146
- <td class="alignright"><p class="label">Use Global value</p></td>
147
  <td>
148
- <input type="radio" checked>
149
- <?php pys_text_field( 'woo', 'view_content_global_value' ); ?>
 
150
  </td>
151
  </tr>
152
 
@@ -194,11 +198,12 @@ if ( ! defined( 'ABSPATH' ) ) {
194
  <td class="alignright"><p class="label big">Define value:</p></td>
195
  <td></td>
196
  </tr>
197
-
198
- <tr class="disabled">
199
- <td class="alignright"><p class="label">Product price</p></td>
200
  <td>
201
- <input type="radio">
 
202
  </td>
203
  </tr>
204
 
@@ -209,12 +214,13 @@ if ( ! defined( 'ABSPATH' ) ) {
209
  <input type="text">%
210
  </td>
211
  </tr>
212
-
213
  <tr>
214
- <td class="alignright"><p class="label">Use Global value</p></td>
215
  <td>
216
- <input type="radio" checked>
217
- <?php pys_text_field( 'woo', 'add_to_cart_global_value' ); ?>
 
218
  </td>
219
  </tr>
220
 
@@ -253,11 +259,12 @@ if ( ! defined( 'ABSPATH' ) ) {
253
  <td class="alignright"><p class="label big">Define value:</p></td>
254
  <td></td>
255
  </tr>
256
-
257
- <tr class="disabled">
258
- <td class="alignright"><p class="label">Products price (subtotal)</p></td>
259
  <td>
260
- <input type="radio">
 
261
  </td>
262
  </tr>
263
 
@@ -268,12 +275,13 @@ if ( ! defined( 'ABSPATH' ) ) {
268
  <input type="text">%
269
  </td>
270
  </tr>
271
-
272
  <tr>
273
- <td class="alignright"><p class="label">Use Global value</p></td>
274
  <td>
275
- <input type="radio" checked>
276
- <?php pys_text_field( 'woo', 'checkout_global_value' ); ?>
 
277
  </td>
278
  </tr>
279
 
@@ -332,11 +340,12 @@ if ( ! defined( 'ABSPATH' ) ) {
332
  </select>
333
  </td>
334
  </tr>
335
-
336
- <tr class="disabled">
337
- <td class="alignright"><p class="label">Total</p></td>
338
  <td>
339
- <input type="radio">
 
340
  </td>
341
  </tr>
342
 
@@ -347,12 +356,13 @@ if ( ! defined( 'ABSPATH' ) ) {
347
  <input type="text">%
348
  </td>
349
  </tr>
350
-
351
- <tr>
352
- <td class="alignright"><p class="label">Use Global value</p></td>
353
  <td>
354
- <input type="radio" checked>
355
- <?php pys_text_field( 'woo', 'purchase_global_value' ); ?>
 
356
  </td>
357
  </tr>
358
 
13
 
14
  <hr>
15
  <h2 class="section-title">Facebook Dynamic Product Ads Pixel Settings</h2>
16
+ <table class="layout" id="woo_content_id">
17
  <tr class="tall">
18
  <td colspan="2" class="narrow">
19
  <input type="checkbox" class="woo-events-toggle"><strong>Enable Facebook Dynamic Product Ads</strong>
21
  </td>
22
  </tr>
23
 
24
+ <?php do_action( 'pys_fb_pixel_admin_woo_content_id_before' ); ?>
25
+
26
+ <tr class="content_id">
27
  <td class="alignright"><p class="label">content_ids:</p></td>
28
  <td>
29
  <select name="pys[woo][content_id]">
33
  </td>
34
  </tr>
35
 
36
+ <tr class="content_id">
37
  <td class="alignright"><p class="label">Define Variation ID:</p></td>
38
  <td>
39
  <select name="pys[woo][variation_id]">
128
  <td class="alignright"><p class="label big">Define value:</p></td>
129
  <td></td>
130
  </tr>
131
+
132
+ <tr>
133
+ <td class="alignright"><p class="label"><?php _e( 'Product price', 'pys' ); ?></p></td>
134
  <td>
135
+ <input type="radio" name="pys[woo][view_content_value_option]" value="price"
136
+ <?php echo pys_radio_state( 'woo', 'view_content_value_option', 'price' ); ?> >
137
  </td>
138
  </tr>
139
 
144
  <input type="text">%
145
  </td>
146
  </tr>
147
+
148
  <tr>
149
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
150
  <td>
151
+ <input type="radio" name="pys[woo][view_content_value_option]" value="global"
152
+ <?php echo pys_radio_state( 'woo', 'view_content_value_option', 'global' ); ?> >
153
+ <input type="text" name="pys[woo][view_content_global_value]" value="<?php echo pys_get_option( 'woo', 'view_content_global_value' ); ?>">
154
  </td>
155
  </tr>
156
 
198
  <td class="alignright"><p class="label big">Define value:</p></td>
199
  <td></td>
200
  </tr>
201
+
202
+ <tr>
203
+ <td class="alignright"><p class="label"><?php _e( 'Products price (subtotal)', 'pys' ); ?></p></td>
204
  <td>
205
+ <input type="radio" name="pys[woo][add_to_cart_value_option]" value="price"
206
+ <?php echo pys_radio_state( 'woo', 'add_to_cart_value_option', 'price' ); ?> >
207
  </td>
208
  </tr>
209
 
214
  <input type="text">%
215
  </td>
216
  </tr>
217
+
218
  <tr>
219
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
220
  <td>
221
+ <input type="radio" name="pys[woo][add_to_cart_value_option]" value="global"
222
+ <?php echo pys_radio_state( 'woo', 'add_to_cart_value_option', 'global' ); ?> >
223
+ <input type="text" name="pys[woo][add_to_cart_global_value]" value="<?php echo pys_get_option( 'woo', 'add_to_cart_global_value' ); ?>">
224
  </td>
225
  </tr>
226
 
259
  <td class="alignright"><p class="label big">Define value:</p></td>
260
  <td></td>
261
  </tr>
262
+
263
+ <tr>
264
+ <td class="alignright"><p class="label"><?php _e( 'Products price (subtotal)', 'pys' ); ?></p></td>
265
  <td>
266
+ <input type="radio" name="pys[woo][checkout_value_option]" value="price"
267
+ <?php echo pys_radio_state( 'woo', 'checkout_value_option', 'price' ); ?> >
268
  </td>
269
  </tr>
270
 
275
  <input type="text">%
276
  </td>
277
  </tr>
278
+
279
  <tr>
280
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
281
  <td>
282
+ <input type="radio" name="pys[woo][checkout_value_option]" value="global"
283
+ <?php echo pys_radio_state( 'woo', 'checkout_value_option', 'global' ); ?> >
284
+ <input type="text" name="pys[woo][checkout_global_value]" value="<?php echo pys_get_option( 'woo', 'checkout_global_value' ); ?>">
285
  </td>
286
  </tr>
287
 
340
  </select>
341
  </td>
342
  </tr>
343
+
344
+ <tr>
345
+ <td class="alignright"><p class="label"><?php _e( 'Total', 'pys' ); ?></p></td>
346
  <td>
347
+ <input type="radio" name="pys[woo][purchase_value_option]" value="total"
348
+ <?php echo pys_radio_state( 'woo', 'purchase_value_option', 'total' ); ?> >
349
  </td>
350
  </tr>
351
 
356
  <input type="text">%
357
  </td>
358
  </tr>
359
+
360
+ <tr class="tall">
361
+ <td class="alignright"><p class="label"><?php _e( 'Use Global value', 'pys' ); ?></p></td>
362
  <td>
363
+ <input type="radio" name="pys[woo][purchase_value_option]" value="global"
364
+ <?php echo pys_radio_state( 'woo', 'purchase_value_option', 'global' ); ?> >
365
+ <input type="text" name="pys[woo][purchase_global_value]" value="<?php echo pys_get_option( 'woo', 'purchase_global_value' ); ?>">
366
  </td>
367
  </tr>
368
 
inc/integrations/facebook-for-woocommerce.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage integration with Facebook for WooCommerce plugin.
5
+ */
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit; // Exit if accessed directly.
9
+ }
10
+
11
+ /**
12
+ * Create fake WC_Facebookcommerce_EventsTracker class to remove all unwanted front-end pixel events.
13
+ */
14
+ if ( class_exists( 'WC_Facebookcommerce' ) && ! class_exists( 'WC_Facebookcommerce_EventsTracker' ) ) :
15
+
16
+ /** @noinspection PhpUndefinedClassInspection */
17
+ class WC_Facebookcommerce_EventsTracker {
18
+
19
+ public function __construct( $pixel_id, $user_info ) {
20
+ }
21
+
22
+ public function inject_base_pixel() {
23
+ }
24
+
25
+ public function inject_view_category_event() {
26
+ }
27
+
28
+ public function inject_search_event() {
29
+ }
30
+
31
+ public function inject_view_content_event() {
32
+ }
33
+
34
+ public function inject_add_to_cart_event() {
35
+ }
36
+
37
+ public function inject_initiate_checkout_event() {
38
+ }
39
+
40
+ public function inject_purchase_event( $order_id ) {
41
+ }
42
+
43
+ }
44
+
45
+ endif;
46
+
47
+ /**
48
+ * Setup extra hooks.
49
+ */
50
+ if ( class_exists( 'WC_Facebookcommerce' ) ) :
51
+
52
+ add_filter( 'pys_fb_pixel_woo_product_content_id', 'fb_for_woo_pys_fb_pixel_woo_product_content_id', 10, 4 );
53
+ function fb_for_woo_pys_fb_pixel_woo_product_content_id( $content_id, $product_id, $content_id_format ) {
54
+
55
+ // use value as is
56
+ if( $content_id_format !== 'facebook_for_woocommerce' ) {
57
+ return $content_id;
58
+ }
59
+
60
+ // use Facebook for WooCommerce extension format
61
+ $sku = get_post_meta( $product_id, '_sku', true );
62
+
63
+ return $sku ? $sku : 'wc_post_id_' . $product_id;
64
+
65
+ }
66
+
67
+ add_filter( 'pys_fb_pixel_setting_defaults', 'fb_for_woo_pys_fb_pixel_setting_defaults', 10, 1 );
68
+ function fb_for_woo_pys_fb_pixel_setting_defaults( $setting_defaults ) {
69
+
70
+ $setting_defaults['woo']['content_id_format'] = 'default';
71
+
72
+ return $setting_defaults;
73
+
74
+ }
75
+
76
+ add_action( 'pys_fb_pixel_admin_woo_content_id_before', 'pys_fb_pixel_admin_woo_content_id_before' );
77
+ function pys_fb_pixel_admin_woo_content_id_before() {
78
+
79
+ ?>
80
+
81
+ <tr class="tall">
82
+ <td colspan="2" class="narrow">
83
+ <p><strong>It looks like you're using both PixelYourSite and Facebook Ads Extension. Good, because they can do a great job together!</strong></p>
84
+ <p>Facebook Ads Extension is a useful free tool that lets you import your products to a Facebook shop and adds a very basic Facebook pixel on your site. PixelYourSite is a dedicated plugin that supercharges your Facebook Pixel with extremely useful features.</p>
85
+
86
+ <p>We made it possible to use both plugins together. You just have to decide what ID to use for your events.</p>
87
+
88
+ <p style="margin-top: 0;">
89
+ <input type="radio" name="pys[woo][content_id_format]" value="facebook_for_woocommerce" <?php echo pys_radio_state( 'woo', 'content_id_format', 'facebook_for_woocommerce' ); ?>><strong>Use Facebook for WooCommerce extension content_id logic</strong>
90
+ </p>
91
+
92
+ <p style="margin-top: 0;">
93
+ <input type="radio" name="pys[woo][content_id_format]" value="default" <?php echo pys_radio_state( 'woo', 'content_id_format', 'default' ); ?>><strong>PixelYourSite content_id logic</strong>
94
+ </p>
95
+
96
+ <p><em>* If you plan to use the product catalog created by Facebook for WooCommerce Extension, use the Facebook for WooCommerce Extension ID. If you plan to use older product catalogs, or new ones created with other plugins, it's better to keep the default PixelYourSite settings.</em></p>
97
+ </td>
98
+ </tr>
99
+
100
+
101
+ <script type="text/javascript">
102
+ jQuery(document).ready(function ($) {
103
+
104
+ $('input[name="pys[woo][content_id_format]"]').change(function (e) {
105
+ toggleContentIDFormatControls();
106
+ });
107
+
108
+ toggleContentIDFormatControls();
109
+
110
+ function toggleContentIDFormatControls() {
111
+
112
+ var format = $('input[name="pys[woo][content_id_format]"]:checked').val();
113
+
114
+ if (format == 'default') {
115
+ $('.content_id', '#woo_content_id' ).show();
116
+ } else {
117
+ $('.content_id', '#woo_content_id').hide();
118
+ }
119
+
120
+ }
121
+
122
+ });
123
+ </script>
124
+
125
+ <?php
126
+ }
127
+
128
+ add_action( 'admin_notices', 'fb_for_woo_admin_notice_display' );
129
+ function fb_for_woo_admin_notice_display() {
130
+
131
+ $user_id = get_current_user_id();
132
+
133
+ if( get_user_meta( $user_id, 'fb_for_woo_admin_notice_dismissed' ) ) {
134
+ return;
135
+ }
136
+
137
+ ?>
138
+
139
+ <div class="notice notice-success is-dismissible fb_for_woo_admin_notice">
140
+ <p>You're using both PixelYourSite and Facebook for WooCommerce Extension. Good, because they can do a great job together! <strong><a href="<?php echo admin_url( 'admin.php?page=pixel-your-site&active_tab=woo#woo_content_id' ); ?>">Click here for more details</a></strong>.</p>
141
+ </div>
142
+
143
+ <script type="text/javascript">
144
+ jQuery(document).on('click', '.fb_for_woo_admin_notice .notice-dismiss', function () {
145
+
146
+ jQuery.ajax({
147
+ url: ajaxurl,
148
+ data: {
149
+ action: 'fb_for_woo_admin_notice_dismiss',
150
+ nonce: '<?php echo wp_create_nonce( 'fb_for_woo_admin_notice_dismiss' ); ?>',
151
+ user_id: '<?php echo $user_id; ?>'
152
+ }
153
+ })
154
+
155
+ })
156
+ </script>
157
+
158
+ <?php
159
+ }
160
+
161
+ add_action( 'wp_ajax_fb_for_woo_admin_notice_dismiss', 'fb_for_woo_admin_notice_dismiss_handler' );
162
+ function fb_for_woo_admin_notice_dismiss_handler() {
163
+
164
+ if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'fb_for_woo_admin_notice_dismiss' ) ) {
165
+ return;
166
+ }
167
+
168
+ add_user_meta( $_REQUEST['user_id'], 'fb_for_woo_admin_notice_dismissed', true );
169
+
170
+ }
171
+
172
+ endif;
js/public.js CHANGED
@@ -3,7 +3,7 @@ jQuery(document).ready(function( $ ) {
3
  // load FB pixel
4
  !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
5
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
6
- n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
7
  t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
8
  document,'script','https://connect.facebook.net/en_US/fbevents.js');
9
 
3
  // load FB pixel
4
  !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
5
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
6
+ n.push=n;n.loaded=!0;n.version='2.0';n.agent='dvpixelyoursite';n.queue=[];t=b.createElement(e);t.async=!0;
7
  t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
8
  document,'script','https://connect.facebook.net/en_US/fbevents.js');
9
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: PixelYourSite, c0d3fev3r, themister
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Facebook Pixel
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
- Stable tag: 5.0.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -108,7 +108,7 @@ Retargeting the users that performed a search on your site is a smart strategy b
108
 
109
  <strong>Superb WooCommerce Integration</strong><br>
110
 
111
- Tested with WooCommerce 2.7
112
 
113
  * You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
114
 
@@ -116,7 +116,7 @@ Tested with WooCommerce 2.7
116
 
117
  * **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
118
 
119
- * **Track conversion value for WooCommerce** ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
120
 
121
  * **WooCommerce Conversion Value Optimization:** You can include or exclude TAX for all the WooCommere events and Shipping cost for the Purchase event. You can use the full product price or just a percent of the price for each event Value. You can also set a general value for each event. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
122
 
@@ -124,8 +124,6 @@ Tested with WooCommerce 2.7
124
 
125
  * You can turn ON/OFF value for each WooCommerce event.
126
 
127
- * Set up a general value for each WooCommerce event.
128
-
129
  * Delay the WooCommerce ViewContent Event, so you don't spend your money on retargeting bouncing visitors ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
130
 
131
  * **Super-Powerful Custom Audiences for WooCommerce:** - we automatically track product name, product category and product tags. You can use them to create highly targeted Custom Audiences for improved retargeting campaigns. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
@@ -227,48 +225,62 @@ We maintain an up to date FAQ page on our site:
227
 
228
  <strong><a href="http://www.pixelyoursite.com/facebool-pixel-master-faq" target="_blank"><span style="color:#DE4D4D;">Click here for the FAQ page</span></a></strong>
229
 
230
- **Do I need to copy/paste the Facebook Pixel code somewhere?**
231
 
232
  No, you just have to enter your pixel ID in the dedicated field. The plugin will do the rest for you.
233
 
234
  **Where can I find the Facebook Pixel ID?**
235
 
236
- There are multiple ways to do that. One simple method is to:
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
- * Go to your Facebook Pixel tab in Ads Manager
239
- * You will find the Facebook Pixel ID on the right side of the page
240
 
241
- **What happens when I activate the plugin general settings?**
242
 
243
- a. The pixel code will be added on every page of your site
244
 
245
- b. A "Search" standard event will be added to the search page of your site
246
 
247
- c. A GeneralEvent will be added on every page, pulling content_name, content_ids, and content_type. It can be used for Custom Audiences.
248
 
249
- **What happens when I activate the WooCommerce Setup?**
250
 
251
- ViewContent is added on the product pages
252
- AdToCart event is added on the cart page
253
- AddToCart events is activated on add to cart button click
254
- InitiateCheckout event is added on the Checkout page
255
- Purchase event is added on the Thank You page
256
 
257
- **Can I define new standard events?**
258
 
259
- Yes, you can! There is a simple menu where you can do that. You'll need to add a URL and select the event type you want to add. If necessary, you can give each event a monetary value and its own currency.
260
 
261
- **Can I have more than just one event on a page?**
262
 
263
- Yes, you can! You can have any number of events you want on a page.
264
 
265
- **Can I use your plugin for Facebook Dynamic Ads?**
 
 
 
266
 
267
- Yes, you can! Facebook Dynamic Product Ads are fully supported for WooCommerce. We plan to add a similar integration for Easy Digital Downloads soon.
 
 
 
 
268
 
269
  **Are there any known incompatibilities with other themes or plugins?**
270
 
271
- Any program, service, code or plugin that adds the Pixel Code, since you can't have to similar pixels on a page.
272
 
273
  * We had a problem with Mamaya, a retargeting service
274
  * It won't work with LeadPages or any similar system because those pages are generated outside WordPress
@@ -277,9 +289,10 @@ If any incompatibilities will arise we will add them here and, of course, will t
277
 
278
  **I have the pixel installed on my website and I am running a Facebook Campaign, but the reports are confusing me. How can I see my campaign results?**
279
 
280
- We have an article about how to optimize Facebook Ads Reports:
281
  <strong><a href="http://www.pixelyoursite.com/facebook-ads-reports-optimisation" target="_blank"><span style="color:#DE4D4D;">How to optimize your Facebook Ads Reports for events tracking</span></a></strong>
282
 
 
283
  == Screenshots ==
284
 
285
  1. Add your Facebook Pixel ID and the plugin will insert the code on every page of your website
@@ -294,6 +307,14 @@ We have an article about how to optimize Facebook Ads Reports:
294
 
295
  == Changelog ==
296
 
 
 
 
 
 
 
 
 
297
  = PixelYourSite 5.0.1 =
298
 
299
  * WooCommerce 2.7 compatibility update: we made sure everything works with the latest WooCommerce version.
3
  Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pixel Events, Facebook, New Facebook Pixel Events, Dynamic Events, Standard Events, Facebook Events, Facebook Standard Events, Facebook Dynamic Product Ads, WooCommerce, WooCommerce Facebook Pixel, Facebook Custom Events, Facebook Conversion Value, WooCommerce Affiliate Products, Easy Digital Downloads Pixel, Easy Digital Downloads Facebook Pixel
4
  Requires at least: 3.0.1
5
  Tested up to: 4.7
6
+ Stable tag: 5.0.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
108
 
109
  <strong>Superb WooCommerce Integration</strong><br>
110
 
111
+ Tested with WooCommerce 3
112
 
113
  * You can **insert the Facebook pixel and start tracking events on any WooCommerce** website with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
114
 
116
 
117
  * **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click)
118
 
119
+ * **Track conversion value for WooCommerce**
120
 
121
  * **WooCommerce Conversion Value Optimization:** You can include or exclude TAX for all the WooCommere events and Shipping cost for the Purchase event. You can use the full product price or just a percent of the price for each event Value. You can also set a general value for each event. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
122
 
124
 
125
  * You can turn ON/OFF value for each WooCommerce event.
126
 
 
 
127
  * Delay the WooCommerce ViewContent Event, so you don't spend your money on retargeting bouncing visitors ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
128
 
129
  * **Super-Powerful Custom Audiences for WooCommerce:** - we automatically track product name, product category and product tags. You can use them to create highly targeted Custom Audiences for improved retargeting campaigns. ([Pro Version](http://www.pixelyoursite.com/facebook-pixel-plugin))
225
 
226
  <strong><a href="http://www.pixelyoursite.com/facebool-pixel-master-faq" target="_blank"><span style="color:#DE4D4D;">Click here for the FAQ page</span></a></strong>
227
 
228
+ **Do I need to copy/paste the full Facebook Pixel code somewhere?**
229
 
230
  No, you just have to enter your pixel ID in the dedicated field. The plugin will do the rest for you.
231
 
232
  **Where can I find the Facebook Pixel ID?**
233
 
234
+ You can find it here:
235
+ <a href="https://www.facebook.com/ads/manager/pixel/facebook_pixel" target="_blank">https://www.facebook.com/ads/manager/pixel/facebook_pixel</a>
236
+
237
+ **Can I use the plugin for Custom Audiences or Custom Conversions?**
238
+
239
+ Absolutely yes! Actually, the plugin will super-optimize your site for Custom Audiences and Custom Conversions.
240
+ You will be able to create the classical ones based on URLs, but also Custom Combinations, like people who visited posts from category XYZ, or tagged with tag ABC in the last 30 days.
241
+
242
+ Use the PRO version, and you'll be able to do crazy things, like targeting people that came from Google and visited products under category "blue widget", or clients who bought products of at least $100, using the discount coupon "promo".
243
+
244
+ **I used the old Facebook Pixel, will my audiences still work?**
245
+
246
+ Yes, they will, you won't lose anything.
247
 
248
+ **Does it work with WooCommerce?**
 
249
 
250
+ Yes, it does. The plugin adds all the necessary events, like ViewContent, AddToCart, InitiateCheckout and Purchase. This way you can easily track conversion and c**onversion value.**
251
 
252
+ ** Do I have to manually add the events for WooCommerce?**
253
 
254
+ No, you don't, the plugin will take care of everything for you.
255
 
256
+ **Does it work with Easy Digital Downloads?**
257
 
258
+ Yes, it works in the same way it does with WooCommerce.
259
 
260
+ **Does it work with Dynamic Ads (promote a product catalog)**
 
 
 
 
261
 
262
+ Yes, all the WooCommerce and EDD pixel events are Dynamic Ads ready.
263
 
264
+ **Can I fire additional events if I need to?**
265
 
266
+ Of course, you can fire any type of event (standard or custom) on any URL of your site. You can also use a partial URL by adding a * at the end of it (this way all the URLs starting with that string will be targeted).
267
 
268
+ With the PRO version, you can use Dynamic Events and fire them on:
269
 
270
+ * clicks on external or internal links
271
+ * clicks on CSS elements, like form buttons
272
+ * mouse over CSS elements
273
+ * page scroll
274
 
275
+ **Will your plugin increase the loading time of my site?**
276
+
277
+ The plugin itself is really fast. However, you have to remember that the pixel has to communicate with Facebook to send all the data, and this will add a little load on your site.
278
+
279
+ Will this impact on your visitors? No, because all the requests are asynchronous, meaning that the browser will continue to load and your users will not see any delay whatsoever.
280
 
281
  **Are there any known incompatibilities with other themes or plugins?**
282
 
283
+ Any program, service, code or plugin that adds the Pixel Code, since you can't have two similar pixels on a page.
284
 
285
  * We had a problem with Mamaya, a retargeting service
286
  * It won't work with LeadPages or any similar system because those pages are generated outside WordPress
289
 
290
  **I have the pixel installed on my website and I am running a Facebook Campaign, but the reports are confusing me. How can I see my campaign results?**
291
 
292
+ We have an article about how to create Custom Reports:
293
  <strong><a href="http://www.pixelyoursite.com/facebook-ads-reports-optimisation" target="_blank"><span style="color:#DE4D4D;">How to optimize your Facebook Ads Reports for events tracking</span></a></strong>
294
 
295
+
296
  == Screenshots ==
297
 
298
  1. Add your Facebook Pixel ID and the plugin will insert the code on every page of your website
307
 
308
  == Changelog ==
309
 
310
+ = PixelYourSite 5.0.2 =
311
+
312
+ * Added agent identifier (dvpixelyoursite) as we were directly requested by Facebook
313
+ * Checked and confirmed WooCommerce 3 compatibility
314
+ * Dynamic WooCommerce Events Value based on the product price
315
+ * Facebook for WooCommerce support
316
+
317
+
318
  = PixelYourSite 5.0.1 =
319
 
320
  * WooCommerce 2.7 compatibility update: we made sure everything works with the latest WooCommerce version.