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

Version Description

Download this release

Release Info

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

Code changes from version 7.1.13 to 7.1.14

dist/scripts/public.js CHANGED
@@ -714,30 +714,33 @@ if (!Array.prototype.includes) {
714
  Utils.copyProperties(data, params);
715
  Utils.copyProperties(options.commonEventParams, params);
716
 
717
- // fire server side event gdpr plugin installed
718
- var isApiDisabled = options.gdpr.all_disabled_by_api ||
719
- options.gdpr.facebook_disabled_by_api ||
720
- options.gdpr.cookiebot_integration_enabled ||
721
- options.gdpr.ginger_integration_enabled ||
722
- options.gdpr.cookie_notice_integration_enabled ||
723
- options.gdpr.cookie_law_info_integration_enabled;
724
- // send event from server if they was bloc by gdpr or need send with delay
725
- if( serverEvents.includes(name) && isApiDisabled || allData.delay > 0 || serverEventsDynamic.includes(name))
726
- {
727
- var json = {
728
- action: 'pys_api_event',
729
- pixel: 'facebook',
730
- event: name,
731
- data:data
732
- };
733
- jQuery.ajax( {
734
- type: 'POST',
735
- url: options.ajaxUrl,
736
- data: json,
737
- success: function(){},
738
- });
 
 
739
  }
740
 
 
741
  if("hCR" === name) {
742
  return;
743
  }
@@ -745,9 +748,13 @@ if (!Array.prototype.includes) {
745
  if (options.debug) {
746
  console.log('[Facebook] ' + name, params);
747
  }
 
 
 
 
748
 
749
  if(serverEvents.includes(name) || serverEventsDynamic.includes(name)) { // Deduplicate Pixel and Server-Side Events for Purchase event
750
- fbq(actionType, name, params,{eventID:params.eventID});
751
  } else {
752
  fbq(actionType, name, params);
753
  }
714
  Utils.copyProperties(data, params);
715
  Utils.copyProperties(options.commonEventParams, params);
716
 
717
+ if(options.facebook.serverApiEnabled) {
718
+ // fire server side event gdpr plugin installed
719
+ var isApiDisabled = options.gdpr.all_disabled_by_api ||
720
+ options.gdpr.facebook_disabled_by_api ||
721
+ options.gdpr.cookiebot_integration_enabled ||
722
+ options.gdpr.ginger_integration_enabled ||
723
+ options.gdpr.cookie_notice_integration_enabled ||
724
+ options.gdpr.cookie_law_info_integration_enabled;
725
+ // send event from server if they was bloc by gdpr or need send with delay
726
+ if( serverEvents.includes(name) && isApiDisabled || allData.delay > 0 || serverEventsDynamic.includes(name))
727
+ {
728
+ var json = {
729
+ action: 'pys_api_event',
730
+ pixel: 'facebook',
731
+ event: name,
732
+ data:data
733
+ };
734
+ jQuery.ajax( {
735
+ type: 'POST',
736
+ url: options.ajaxUrl,
737
+ data: json,
738
+ success: function(){},
739
+ });
740
+ }
741
  }
742
 
743
+
744
  if("hCR" === name) {
745
  return;
746
  }
748
  if (options.debug) {
749
  console.log('[Facebook] ' + name, params);
750
  }
751
+ var arg = {};
752
+ if(options.facebook.serverApiEnabled && params.hasOwnProperty('eventID')) {
753
+ arg.eventID = params.eventID;
754
+ }
755
 
756
  if(serverEvents.includes(name) || serverEventsDynamic.includes(name)) { // Deduplicate Pixel and Server-Side Events for Purchase event
757
+ fbq(actionType, name, params,arg);
758
  } else {
759
  fbq(actionType, name, params);
760
  }
facebook-pixel-master.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global Events, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
- * Version: 7.1.13
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
4
  * Plugin Name: PixelYourSite
5
  * Plugin URI: http://www.pixelyoursite.com/
6
  * Description: No codding <strong>Facebook Pixel</strong> and <strong>Google Analytics</strong> install. Track key actions with our Global Events, or configure your own events. WooCommerce and EDD fully supported, with Facebook Dynamic Ads Pixel set-up and Google Analytics Enhanced Ecommerce. Insert any custom script with our Head & Footer option. Add the <strong>Pinterest Tag</strong> with our free add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff.
7
+ * Version: 7.1.14
8
  * Author: PixelYourSite
9
  * Author URI: http://www.pixelyoursite.com
10
  * License: GPLv3
modules/facebook/facebook.php CHANGED
@@ -206,12 +206,13 @@ class Facebook extends Settings implements Pixel {
206
  }
207
 
208
  private function getPageViewEventParams() {
209
-
 
 
 
210
  return array(
211
  'name' => 'PageView',
212
- 'data' => array(
213
- 'eventID' => "pv_".time()
214
- ),
215
  );
216
 
217
  }
@@ -418,7 +419,10 @@ class Facebook extends Settings implements Pixel {
418
  ) );
419
 
420
  }
421
- $params['eventID'] = $post->ID."_".time();
 
 
 
422
  $params['product_price'] = getWooProductPriceToDisplay( $post->ID );
423
 
424
  return array(
@@ -450,7 +454,10 @@ class Facebook extends Settings implements Pixel {
450
  }
451
 
452
  $params = Helpers\getWooCartParams();
453
- $params['eventID'] = "add_cart_".time();
 
 
 
454
  return array(
455
  'name' => 'AddToCart',
456
  'data' => $params,
@@ -543,7 +550,10 @@ class Facebook extends Settings implements Pixel {
543
  }
544
 
545
  $params = Helpers\getWooCartParams( 'InitiateCheckout' );
546
- $params['eventID'] = "init_check_".time();
 
 
 
547
  return array(
548
  'name' => 'InitiateCheckout',
549
  'data' => $params,
@@ -624,7 +634,10 @@ class Facebook extends Settings implements Pixel {
624
  $params['value'] = getWooEventValueOrder( $value_option, $order, $global_value );
625
  $params['currency'] = get_woocommerce_currency();
626
  //$params['transaction_id'] = $order_id;
627
- $params['eventID'] = $order_id;
 
 
 
628
  return array(
629
  'name' => 'Purchase',
630
  'data' => $params,
@@ -701,7 +714,10 @@ class Facebook extends Settings implements Pixel {
701
 
702
  }
703
  $params['currency'] = edd_get_currency();
704
- $params['eventID'] = $post->ID."_".time();
 
 
 
705
  // contents
706
  $params['contents'] = json_encode( array(
707
  array(
@@ -762,7 +778,10 @@ class Facebook extends Settings implements Pixel {
762
  'item_price' => getEddDownloadPriceToDisplay( $download_id ),
763
  )
764
  ) );
765
- $params['eventID'] = $download_id."_".time();
 
 
 
766
  return array(
767
  'data' => $params,
768
  );
@@ -878,11 +897,17 @@ class Facebook extends Settings implements Pixel {
878
  }
879
 
880
  if($context == 'AddToCart') {
881
- $params['eventID'] = "edd_add_cart_".time();
 
 
882
 
883
  }
884
- if($context == 'InitiateCheckout')
885
- $params['eventID'] = "init_check_".time();
 
 
 
 
886
 
887
  if ( $context == 'Purchase' ) {
888
 
@@ -891,7 +916,10 @@ class Facebook extends Settings implements Pixel {
891
 
892
 
893
  $params['value'] = edd_get_payment_amount( $payment_id );
894
- $params['eventID'] = $payment_id;
 
 
 
895
 
896
  }
897
  $params['currency'] = edd_get_currency();
206
  }
207
 
208
  private function getPageViewEventParams() {
209
+ $data = array();
210
+ if($this->isServerApiEnabled()) {
211
+ $data['eventID'] = "pv_".time();
212
+ }
213
  return array(
214
  'name' => 'PageView',
215
+ 'data' => $data,
 
 
216
  );
217
 
218
  }
419
  ) );
420
 
421
  }
422
+ if($this->isServerApiEnabled()) {
423
+ $params['eventID'] = $post->ID."_".time();
424
+ }
425
+
426
  $params['product_price'] = getWooProductPriceToDisplay( $post->ID );
427
 
428
  return array(
454
  }
455
 
456
  $params = Helpers\getWooCartParams();
457
+ if($this->isServerApiEnabled()) {
458
+ $params['eventID'] = "add_cart_".time();
459
+ }
460
+
461
  return array(
462
  'name' => 'AddToCart',
463
  'data' => $params,
550
  }
551
 
552
  $params = Helpers\getWooCartParams( 'InitiateCheckout' );
553
+ if($this->isServerApiEnabled()) {
554
+ $params['eventID'] = "init_check_".time();
555
+ }
556
+
557
  return array(
558
  'name' => 'InitiateCheckout',
559
  'data' => $params,
634
  $params['value'] = getWooEventValueOrder( $value_option, $order, $global_value );
635
  $params['currency'] = get_woocommerce_currency();
636
  //$params['transaction_id'] = $order_id;
637
+
638
+ if($this->isServerApiEnabled()) {
639
+ $params['eventID'] = $order_id;
640
+ }
641
  return array(
642
  'name' => 'Purchase',
643
  'data' => $params,
714
 
715
  }
716
  $params['currency'] = edd_get_currency();
717
+ if($this->isServerApiEnabled()) {
718
+ $params['eventID'] = $post->ID."_".time();
719
+ }
720
+
721
  // contents
722
  $params['contents'] = json_encode( array(
723
  array(
778
  'item_price' => getEddDownloadPriceToDisplay( $download_id ),
779
  )
780
  ) );
781
+ if($this->isServerApiEnabled()) {
782
+ $params['eventID'] = $download_id."_".time();
783
+ }
784
+
785
  return array(
786
  'data' => $params,
787
  );
897
  }
898
 
899
  if($context == 'AddToCart') {
900
+ if($this->isServerApiEnabled()) {
901
+ $params['eventID'] = "edd_add_cart_".time();
902
+ }
903
 
904
  }
905
+ if($context == 'InitiateCheckout') {
906
+ if($this->isServerApiEnabled()) {
907
+ $params['eventID'] = "init_check_".time();
908
+ }
909
+ }
910
+
911
 
912
  if ( $context == 'Purchase' ) {
913
 
916
 
917
 
918
  $params['value'] = edd_get_payment_amount( $payment_id );
919
+ if($this->isServerApiEnabled()) {
920
+ $params['eventID'] = $payment_id."_".time();
921
+ }
922
+
923
 
924
  }
925
  $params['currency'] = edd_get_currency();
modules/facebook/function-helpers.php CHANGED
@@ -300,7 +300,10 @@ function getWooSingleAddToCartParams( $product_id, $qty = 1 ) {
300
 
301
  }
302
  $params['currency'] = get_woocommerce_currency();
303
- $params['eventID'] = (string) $product_id."_".time();
 
 
 
304
  // contents
305
  if ( isDefaultWooContentIdLogic() ) {
306
 
@@ -565,7 +568,10 @@ function getCompleteRegistrationOrderParams() {
565
  $global_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_global_value', 0 );
566
  $percents_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_percent_value', 100 );
567
 
568
- $params['eventID'] = $order_id;
 
 
 
569
  $params['value'] = PixelYourSite\getWooEventValueOrder( $value_option, $order, $global_value, $percents_value );
570
  $params['currency'] = get_woocommerce_currency();
571
  return $params;
300
 
301
  }
302
  $params['currency'] = get_woocommerce_currency();
303
+ if(PixelYourSite\Facebook()->isServerApiEnabled()) {
304
+ $params['eventID'] = (string) $product_id."_".time();
305
+ }
306
+
307
  // contents
308
  if ( isDefaultWooContentIdLogic() ) {
309
 
568
  $global_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_global_value', 0 );
569
  $percents_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_percent_value', 100 );
570
 
571
+ if(PixelYourSite\Facebook()->isServerApiEnabled()) {
572
+ $params['eventID'] = $order_id."_".time();
573
+ }
574
+
575
  $params['value'] = PixelYourSite\getWooEventValueOrder( $value_option, $order, $global_value, $percents_value );
576
  $params['currency'] = get_woocommerce_currency();
577
  return $params;
pixelyoursite.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- define( 'PYS_FREE_VERSION', '7.1.13' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ define( 'PYS_FREE_VERSION', '7.1.14' );
8
  define( 'PYS_FREE_PINTEREST_MIN_VERSION', '2.0.6' );
9
  define( 'PYS_FREE_BING_MIN_VERSION', '1.0.0' );
10
  define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Facebook Pixel, New Facebook Pixel, Facebook Conversion Pixel, Facebook Pi
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
  Tested up to: 5.5
7
- Stable tag: 7.1.13
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -390,6 +390,13 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
390
 
391
  == Changelog ==
392
 
 
 
 
 
 
 
 
393
  = PixelYourSite 7.1.13 =
394
 
395
  * NEW: Facebook Conversion API (former server-side events) works for all standard events automatically fired by the plugin. We will expand this feature to all events soon.
4
  Requires at least: 3.0.1
5
  Requires PHP: 5.4
6
  Tested up to: 5.5
7
+ Stable tag: 7.1.14
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
390
 
391
  == Changelog ==
392
 
393
+
394
+ = PixelYourSite 7.1.14 =
395
+
396
+ * We removed the EventID parameter when Facebook Conversion API is not configured.
397
+
398
+ * If you have Conversion API configured, we recommend to check if your cache plugin stores the EventID. [Watch this video to learn more](https://www.youtube.com/watch?v=YH6ve7qj1hw&)
399
+
400
  = PixelYourSite 7.1.13 =
401
 
402
  * NEW: Facebook Conversion API (former server-side events) works for all standard events automatically fired by the plugin. We will expand this feature to all events soon.