Version Description
Download this release
Release Info
Developer | PixelYourSite |
Plugin | PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) |
Version | 8.2.17 |
Comparing to | |
See all releases |
Code changes from version 8.2.16 to 8.2.17
- facebook-pixel-master.php +2 -2
- includes/class-events-manager-ajax_hook.php +36 -19
- includes/class-events-manager.php +0 -14
- includes/events/class-events-woo.php +12 -3
- includes/views/html-main-edd.php +19 -0
- includes/views/html-main-woo.php +7 -1
- modules/facebook/facebook.php +0 -7
- modules/google_analytics/ga.php +1 -1
- pixelyoursite.php +1 -1
- readme.txt +15 -2
facebook-pixel-master.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: PixelYourSite
|
5 |
* Plugin URI: http://www.pixelyoursite.com/
|
6 |
* Description: No coding <strong>Meta Pixel (formerly Facebook Pixel), Facebook Converion API,</strong> and <strong>Google Analytics</strong> install. Track key actions with our Signal event, 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 paid add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff. Full support for <strong>ConsentMagic.com</strong>.
|
7 |
-
* Version: 8.2.
|
8 |
* Author: PixelYourSite
|
9 |
* Author URI: http://www.pixelyoursite.com
|
10 |
* License: GPLv3
|
@@ -13,7 +13,7 @@
|
|
13 |
* Tested up to: 5.9
|
14 |
*
|
15 |
* WC requires at least: 2.6.0
|
16 |
-
* WC tested up to: 6.
|
17 |
*
|
18 |
* Text Domain: pys
|
19 |
*/
|
4 |
* Plugin Name: PixelYourSite
|
5 |
* Plugin URI: http://www.pixelyoursite.com/
|
6 |
* Description: No coding <strong>Meta Pixel (formerly Facebook Pixel), Facebook Converion API,</strong> and <strong>Google Analytics</strong> install. Track key actions with our Signal event, 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 paid add-on. The PRO version adds support for the Google Ads tag plus a lot of extra stuff. Full support for <strong>ConsentMagic.com</strong>.
|
7 |
+
* Version: 8.2.17
|
8 |
* Author: PixelYourSite
|
9 |
* Author URI: http://www.pixelyoursite.com
|
10 |
* License: GPLv3
|
13 |
* Tested up to: 5.9
|
14 |
*
|
15 |
* WC requires at least: 2.6.0
|
16 |
+
* WC tested up to: 6.2
|
17 |
*
|
18 |
* Text Domain: pys
|
19 |
*/
|
includes/class-events-manager-ajax_hook.php
CHANGED
@@ -8,10 +8,34 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
8 |
|
9 |
class AjaxHookEventManager {
|
10 |
|
11 |
-
public static $pendingEvents = array();
|
12 |
public static $DIV_ID_FOR_AJAX_EVENTS = "pys_ajax_events";
|
13 |
private static $_instance;
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public static function instance() {
|
16 |
|
17 |
if ( is_null( self::$_instance ) ) {
|
@@ -42,6 +66,11 @@ class AjaxHookEventManager {
|
|
42 |
if(PYS()->getOption('woo_add_to_cart_catch_method') == "add_cart_hook") {
|
43 |
add_action( 'wp_footer', array( __CLASS__, 'addDivForAjaxPixelEvent') );
|
44 |
add_action( 'woocommerce_add_to_cart',array(__CLASS__, 'trackWooAddToCartEvent'),40, 6);
|
|
|
|
|
|
|
|
|
|
|
45 |
} else {
|
46 |
add_action( 'woocommerce_after_add_to_cart_button', 'PixelYourSite\EventsManager::setupWooSingleProductData' );
|
47 |
}
|
@@ -66,7 +95,7 @@ class AjaxHookEventManager {
|
|
66 |
$standardParams = getStandardParams();
|
67 |
|
68 |
PYS()->getLog()->debug('trackWooAddToCartEvent is_ajax_request '.$is_ajax_request);
|
69 |
-
|
70 |
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
|
71 |
|
72 |
if( !empty($variation_id)
|
@@ -99,7 +128,7 @@ class AjaxHookEventManager {
|
|
99 |
$eventData = $event->getData();
|
100 |
$eventData = EventsManager::filterEventParams($eventData,"woo");
|
101 |
|
102 |
-
|
103 |
|
104 |
if($pixel->getSlug() == "facebook" && Facebook()->isServerApiEnabled()) {
|
105 |
|
@@ -110,24 +139,14 @@ class AjaxHookEventManager {
|
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
-
|
114 |
-
if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
|
115 |
-
add_filter('wc_add_to_cart_message_html',array(__CLASS__, 'addPixelCodeToAddToCarMessage'),90,3);
|
116 |
-
} elseif ($is_ajax_request) {
|
117 |
-
add_filter('woocommerce_add_to_cart_fragments', array(__CLASS__, 'addPixelCodeToAddToCartFragment'));
|
118 |
-
} else {
|
119 |
-
add_action("wp_footer",array(__CLASS__, 'printEvent'));
|
120 |
-
// self::printEvent();
|
121 |
-
}
|
122 |
-
|
123 |
}
|
124 |
|
125 |
public static function printEvent() {
|
126 |
-
$pixelsEventData = self
|
127 |
if( !is_null($pixelsEventData) ) {
|
128 |
PYS()->getLog()->debug('trackWooAddToCartEvent printEvent is footer');
|
129 |
echo "<div id='pys_late_event' style='display:none' dir='".json_encode($pixelsEventData)."'></div>";
|
130 |
-
unset(self::$pendingEvents["woo_add_to_cart_on_button_click"]);
|
131 |
}
|
132 |
}
|
133 |
|
@@ -152,10 +171,9 @@ class AjaxHookEventManager {
|
|
152 |
}
|
153 |
|
154 |
public static function addPixelCodeToAddToCarMessage($message, $products, $show_qty) {
|
155 |
-
$pixelsEventData = self
|
156 |
if( !is_null($pixelsEventData) ){
|
157 |
$message .= "<div id='pys_late_event' dir='".json_encode($pixelsEventData)."'></div>";
|
158 |
-
unset(self::$pendingEvents["woo_add_to_cart_on_button_click"]);
|
159 |
}
|
160 |
return $message;
|
161 |
}
|
@@ -163,13 +181,12 @@ class AjaxHookEventManager {
|
|
163 |
public static function addPixelCodeToAddToCartFragment($fragments) {
|
164 |
|
165 |
|
166 |
-
$pixelsEventData = self
|
167 |
if( !is_null($pixelsEventData) ){
|
168 |
PYS()->getLog()->debug('addPixelCodeToAddToCartFragment send data with fragment');
|
169 |
$pixel_code = self::generatePixelCode($pixelsEventData);
|
170 |
$fragments['#'.self::$DIV_ID_FOR_AJAX_EVENTS] =
|
171 |
self::getDivForAjaxPixelEvent($pixel_code);
|
172 |
-
unset(self::$pendingEvents["woo_add_to_cart_on_button_click"]);
|
173 |
}
|
174 |
|
175 |
return $fragments;
|
8 |
|
9 |
class AjaxHookEventManager {
|
10 |
|
|
|
11 |
public static $DIV_ID_FOR_AJAX_EVENTS = "pys_ajax_events";
|
12 |
private static $_instance;
|
13 |
|
14 |
+
static function addPendingEvent($name,$event) {
|
15 |
+
$events = WC()->session->get( 'pys_events', array() );
|
16 |
+
$events[$name] = $event;
|
17 |
+
WC()->session->set( 'pys_events', $events );
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @param $name
|
22 |
+
* @param $slug
|
23 |
+
* @return mixed|null
|
24 |
+
*/
|
25 |
+
static function getPendingEvent($name,$unset) {
|
26 |
+
$events = WC()->session->get( 'pys_events', array() );
|
27 |
+
|
28 |
+
if(isset($events[$name]) ) {
|
29 |
+
$event = $events[$name];
|
30 |
+
if($unset){
|
31 |
+
unset($events[$name]);
|
32 |
+
WC()->session->set( 'pys_events', $events );
|
33 |
+
}
|
34 |
+
return $event;
|
35 |
+
}
|
36 |
+
return null;
|
37 |
+
}
|
38 |
+
|
39 |
public static function instance() {
|
40 |
|
41 |
if ( is_null( self::$_instance ) ) {
|
66 |
if(PYS()->getOption('woo_add_to_cart_catch_method') == "add_cart_hook") {
|
67 |
add_action( 'wp_footer', array( __CLASS__, 'addDivForAjaxPixelEvent') );
|
68 |
add_action( 'woocommerce_add_to_cart',array(__CLASS__, 'trackWooAddToCartEvent'),40, 6);
|
69 |
+
if (wp_doing_ajax()) {
|
70 |
+
add_filter('woocommerce_add_to_cart_fragments', array(__CLASS__, 'addPixelCodeToAddToCartFragment'));
|
71 |
+
} else {
|
72 |
+
add_action("wp_footer",array(__CLASS__, 'printEvent'));
|
73 |
+
}
|
74 |
} else {
|
75 |
add_action( 'woocommerce_after_add_to_cart_button', 'PixelYourSite\EventsManager::setupWooSingleProductData' );
|
76 |
}
|
95 |
$standardParams = getStandardParams();
|
96 |
|
97 |
PYS()->getLog()->debug('trackWooAddToCartEvent is_ajax_request '.$is_ajax_request);
|
98 |
+
$dataList = [];
|
99 |
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
|
100 |
|
101 |
if( !empty($variation_id)
|
128 |
$eventData = $event->getData();
|
129 |
$eventData = EventsManager::filterEventParams($eventData,"woo");
|
130 |
|
131 |
+
$dataList[$pixel->getSlug()] = $eventData;
|
132 |
|
133 |
if($pixel->getSlug() == "facebook" && Facebook()->isServerApiEnabled()) {
|
134 |
|
139 |
}
|
140 |
}
|
141 |
}
|
142 |
+
AjaxHookEventManager::addPendingEvent("woo_add_to_cart_on_button_click",$dataList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
public static function printEvent() {
|
146 |
+
$pixelsEventData = self::getPendingEvent("woo_add_to_cart_on_button_click",true);
|
147 |
if( !is_null($pixelsEventData) ) {
|
148 |
PYS()->getLog()->debug('trackWooAddToCartEvent printEvent is footer');
|
149 |
echo "<div id='pys_late_event' style='display:none' dir='".json_encode($pixelsEventData)."'></div>";
|
|
|
150 |
}
|
151 |
}
|
152 |
|
171 |
}
|
172 |
|
173 |
public static function addPixelCodeToAddToCarMessage($message, $products, $show_qty) {
|
174 |
+
$pixelsEventData = self::getPendingEvent("woo_add_to_cart_on_button_click",true);
|
175 |
if( !is_null($pixelsEventData) ){
|
176 |
$message .= "<div id='pys_late_event' dir='".json_encode($pixelsEventData)."'></div>";
|
|
|
177 |
}
|
178 |
return $message;
|
179 |
}
|
181 |
public static function addPixelCodeToAddToCartFragment($fragments) {
|
182 |
|
183 |
|
184 |
+
$pixelsEventData = self::getPendingEvent("woo_add_to_cart_on_button_click",true);
|
185 |
if( !is_null($pixelsEventData) ){
|
186 |
PYS()->getLog()->debug('addPixelCodeToAddToCartFragment send data with fragment');
|
187 |
$pixel_code = self::generatePixelCode($pixelsEventData);
|
188 |
$fragments['#'.self::$DIV_ID_FOR_AJAX_EVENTS] =
|
189 |
self::getDivForAjaxPixelEvent($pixel_code);
|
|
|
190 |
}
|
191 |
|
192 |
return $fragments;
|
includes/class-events-manager.php
CHANGED
@@ -192,20 +192,6 @@ class EventsManager {
|
|
192 |
}
|
193 |
}
|
194 |
|
195 |
-
/**
|
196 |
-
* Always returns empty customer LTV-related values to make plugin compatible with PRO version.
|
197 |
-
* Used by Pinterest add-on.
|
198 |
-
*
|
199 |
-
* @return array
|
200 |
-
*/
|
201 |
-
public function getWooCustomerTotals() {
|
202 |
-
return [
|
203 |
-
'ltv' => null,
|
204 |
-
'avg_order_value' => null,
|
205 |
-
'orders_count' => null,
|
206 |
-
];
|
207 |
-
}
|
208 |
-
|
209 |
public function getStaticEvents( $context ) {
|
210 |
return isset( $this->staticEvents[ $context ] ) ? $this->staticEvents[ $context ] : array();
|
211 |
}
|
192 |
}
|
193 |
}
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
public function getStaticEvents( $context ) {
|
196 |
return isset( $this->staticEvents[ $context ] ) ? $this->staticEvents[ $context ] : array();
|
197 |
}
|
includes/events/class-events-woo.php
CHANGED
@@ -280,9 +280,18 @@ class EventsWoo extends EventsFactory {
|
|
280 |
}
|
281 |
return array_unique($fireForCategory);
|
282 |
}
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
|
288 |
function getEvents() {
|
280 |
}
|
281 |
return array_unique($fireForCategory);
|
282 |
}
|
283 |
+
/**
|
284 |
+
* Always returns empty customer LTV-related values to make plugin compatible with PRO version.
|
285 |
+
* Used by Pinterest add-on.
|
286 |
+
*
|
287 |
+
* @return array
|
288 |
+
*/
|
289 |
+
function getCustomerTotals($order_id = null){
|
290 |
+
return [
|
291 |
+
'ltv' => null,
|
292 |
+
'avg_order_value' => null,
|
293 |
+
'orders_count' => null,
|
294 |
+
];
|
295 |
}
|
296 |
|
297 |
function getEvents() {
|
includes/views/html-main-edd.php
CHANGED
@@ -11,6 +11,25 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
<h2 class="section-title">EasyDigitalDownloads Settings</h2>
|
12 |
|
13 |
<!-- Enable EDD -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<div class="card card-static">
|
15 |
<div class="card-header">
|
16 |
General
|
11 |
<h2 class="section-title">EasyDigitalDownloads Settings</h2>
|
12 |
|
13 |
<!-- Enable EDD -->
|
14 |
+
<div class="card card-static">
|
15 |
+
<div class="card-body">
|
16 |
+
<div class="row">
|
17 |
+
<div class="col">
|
18 |
+
<?php renderDummySwitcher( false); ?>
|
19 |
+
<h4 class="switcher-label">Facebook auto-renewals purchase tracking</h4><?php renderProBadge(); ?>
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
<div class="row">
|
23 |
+
<div class="col">
|
24 |
+
<?php renderDummySwitcher( false); ?>
|
25 |
+
<h4 class="switcher-label">Google Analytics auto-renewals purchase tracking</h4><?php renderProBadge(); ?>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<p class="small">
|
29 |
+
The plugin will send a purchase event using Facebook and Google Analytics API when auto-renewals take place. This feature is not yet supported for GA4 properties.
|
30 |
+
</p>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
<div class="card card-static">
|
34 |
<div class="card-header">
|
35 |
General
|
includes/views/html-main-woo.php
CHANGED
@@ -18,7 +18,13 @@ use PixelYourSite\Facebook\Helpers;
|
|
18 |
<div class="row">
|
19 |
<div class="col">
|
20 |
<?php renderDummySwitcher( false); ?>
|
21 |
-
<h4 class="switcher-label">Advanced Purchase Tracking</h4><?php renderProBadge(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
</div>
|
23 |
</div>
|
24 |
<p class="small">
|
18 |
<div class="row">
|
19 |
<div class="col">
|
20 |
<?php renderDummySwitcher( false); ?>
|
21 |
+
<h4 class="switcher-label">Facebook Advanced Purchase Tracking</h4><?php renderProBadge(); ?>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
<div class="row">
|
25 |
+
<div class="col">
|
26 |
+
<?php renderDummySwitcher( false); ?>
|
27 |
+
<h4 class="switcher-label">Google Analytics Advanced Purchase Tracking</h4><?php renderProBadge(); ?>
|
28 |
</div>
|
29 |
</div>
|
30 |
<p class="small">
|
modules/facebook/facebook.php
CHANGED
@@ -1077,12 +1077,6 @@ class Facebook extends Settings implements Pixel {
|
|
1077 |
$item_options = $cart_item['options'];
|
1078 |
}
|
1079 |
|
1080 |
-
if ( ! empty( $item_options ) && $item_options['price_id'] !== 0 ) {
|
1081 |
-
$price_index = $item_options['price_id'];
|
1082 |
-
} else {
|
1083 |
-
$price_index = null;
|
1084 |
-
}
|
1085 |
-
|
1086 |
// calculate cart items total
|
1087 |
if ( $value_enabled ) {
|
1088 |
|
@@ -1098,7 +1092,6 @@ class Facebook extends Settings implements Pixel {
|
|
1098 |
$contents[] = array(
|
1099 |
'id' => (string) $download_id,
|
1100 |
'quantity' => $cart_item['quantity'],
|
1101 |
-
//'item_price' => getEddDownloadPriceToDisplay( $download_id, $price_index ),
|
1102 |
);
|
1103 |
|
1104 |
}
|
1077 |
$item_options = $cart_item['options'];
|
1078 |
}
|
1079 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1080 |
// calculate cart items total
|
1081 |
if ( $value_enabled ) {
|
1082 |
|
1092 |
$contents[] = array(
|
1093 |
'id' => (string) $download_id,
|
1094 |
'quantity' => $cart_item['quantity'],
|
|
|
1095 |
);
|
1096 |
|
1097 |
}
|
modules/google_analytics/ga.php
CHANGED
@@ -943,7 +943,7 @@ class GA extends Settings implements Pixel {
|
|
943 |
$item_options = $cart_item['options'];
|
944 |
}
|
945 |
|
946 |
-
if ( ! empty( $item_options ) && $item_options['price_id']
|
947 |
$price_index = $item_options['price_id'];
|
948 |
} else {
|
949 |
$price_index = null;
|
943 |
$item_options = $cart_item['options'];
|
944 |
}
|
945 |
|
946 |
+
if ( ! empty( $item_options ) && !empty($item_options['price_id'])) {
|
947 |
$price_index = $item_options['price_id'];
|
948 |
} else {
|
949 |
$price_index = null;
|
pixelyoursite.php
CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
-
define( 'PYS_FREE_VERSION', '8.2.
|
8 |
define( 'PYS_FREE_PINTEREST_MIN_VERSION', '3.2.5' );
|
9 |
define( 'PYS_FREE_BING_MIN_VERSION', '2.2.2' );
|
10 |
define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
+
define( 'PYS_FREE_VERSION', '8.2.17' );
|
8 |
define( 'PYS_FREE_PINTEREST_MIN_VERSION', '3.2.5' );
|
9 |
define( 'PYS_FREE_BING_MIN_VERSION', '2.2.2' );
|
10 |
define( 'PYS_FREE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: Meta Pixel, Facebook Pixel, Facebook Conversion API, CAPI, Facebook Pixel
|
|
4 |
Requires at least: 3.0.1
|
5 |
Requires PHP: 5.4
|
6 |
Tested up to: 5.9
|
7 |
-
Stable tag: 8.2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -460,13 +460,26 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
|
|
460 |
== Changelog ==
|
461 |
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
= PixelYourSite 8.2.16 =
|
464 |
|
465 |
* Terminology change, we are now using "The Meta Pixel" along with "The Facebook Pixel".
|
466 |
|
467 |
* Fix for a possible issue with WooCommerce variable products that have a large number of variations creating a loading page speed problem.
|
468 |
|
469 |
-
*
|
470 |
|
471 |
* WordPress 5.9 compatibility.
|
472 |
|
4 |
Requires at least: 3.0.1
|
5 |
Requires PHP: 5.4
|
6 |
Tested up to: 5.9
|
7 |
+
Stable tag: 8.2.17
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
460 |
== Changelog ==
|
461 |
|
462 |
|
463 |
+
= PixelYourSite 8.2.17 =
|
464 |
+
|
465 |
+
* UI changes to reflect some paid features: WooCommerce split advanced purchase tracking for Facebook and Google Analytics.
|
466 |
+
|
467 |
+
* UI changes to reflect some paid features: Easy Digital Downloads recurring trading for Facebook and Google Analytics.
|
468 |
+
|
469 |
+
* Fixing some potential issues related to the Pinterest add-on.
|
470 |
+
|
471 |
+
* Fixing other small code issues.
|
472 |
+
|
473 |
+
* WooCommerce 6.2 compatibility check.
|
474 |
+
|
475 |
+
|
476 |
= PixelYourSite 8.2.16 =
|
477 |
|
478 |
* Terminology change, we are now using "The Meta Pixel" along with "The Facebook Pixel".
|
479 |
|
480 |
* Fix for a possible issue with WooCommerce variable products that have a large number of variations creating a loading page speed problem.
|
481 |
|
482 |
+
* Video link updates.
|
483 |
|
484 |
* WordPress 5.9 compatibility.
|
485 |
|