Version Description
Download this release
Release Info
Developer | PixelYourSite |
Plugin | PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) |
Version | 7.1.11 |
Comparing to | |
See all releases |
Code changes from version 7.1.10 to 7.1.11
- facebook-pixel-master.php +1 -1
- includes/class-events-manager.php +11 -3
- includes/functions-common.php +125 -123
- includes/functions-woo.php +116 -77
- includes/views/html-main-general.php +3 -3
- modules/facebook/PYSServerEventHelper.php +1 -1
- modules/facebook/facebook.php +5 -6
- modules/facebook/function-helpers.php +6 -8
- pixelyoursite.php +1 -1
- readme.txt +11 -2
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.
|
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.11
|
8 |
* Author: PixelYourSite
|
9 |
* Author URI: http://www.pixelyoursite.com
|
10 |
* License: GPLv3
|
includes/class-events-manager.php
CHANGED
@@ -155,15 +155,16 @@ class EventsManager {
|
|
155 |
|
156 |
if ( isWooCommerceActive() && PYS()->getOption( 'woo_enabled' ) ) {
|
157 |
$this->setupWooCommerceEvents();
|
158 |
-
|
159 |
-
Facebook()->trackEventByServerApi(EventsManager::$facebookServerEvents);
|
160 |
-
}
|
161 |
}
|
162 |
|
163 |
if ( isEddActive() && PYS()->getOption( 'edd_enabled' ) ) {
|
164 |
$this->setupEddEvents();
|
165 |
}
|
166 |
|
|
|
|
|
|
|
167 |
}
|
168 |
|
169 |
/**
|
@@ -214,6 +215,13 @@ class EventsManager {
|
|
214 |
'ids' => $ids,
|
215 |
);
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
|
219 |
}
|
155 |
|
156 |
if ( isWooCommerceActive() && PYS()->getOption( 'woo_enabled' ) ) {
|
157 |
$this->setupWooCommerceEvents();
|
158 |
+
|
|
|
|
|
159 |
}
|
160 |
|
161 |
if ( isEddActive() && PYS()->getOption( 'edd_enabled' ) ) {
|
162 |
$this->setupEddEvents();
|
163 |
}
|
164 |
|
165 |
+
if(count(EventsManager::$facebookServerEvents)>0 && Facebook()->enabled()) {
|
166 |
+
Facebook()->trackEventByServerApi(EventsManager::$facebookServerEvents);
|
167 |
+
}
|
168 |
}
|
169 |
|
170 |
/**
|
215 |
'ids' => $ids,
|
216 |
);
|
217 |
|
218 |
+
// fire fb server api event
|
219 |
+
if(Facebook()->enabled() && $pixel->getSlug() == "facebook" && $eventType == 'edd_purchase') {
|
220 |
+
if($eventData != null) {
|
221 |
+
$this->addEventToFacebookServerApi(Facebook(),'edd_purchase',$eventData);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
}
|
226 |
|
227 |
}
|
includes/functions-common.php
CHANGED
@@ -234,134 +234,136 @@ function getAvailableProductCog($product_id) {
|
|
234 |
|
235 |
}
|
236 |
|
237 |
-
function getAvailableProductCogOrder($
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
}
|
298 |
-
}
|
299 |
|
300 |
-
|
301 |
|
302 |
}
|
303 |
|
304 |
-
function getAvailableProductCogCart(
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
|
|
|
|
|
|
|
|
363 |
|
364 |
-
|
365 |
|
366 |
}
|
367 |
|
234 |
|
235 |
}
|
236 |
|
237 |
+
function getAvailableProductCogOrder($order) {
|
238 |
+
|
239 |
+
$cost = 0;
|
240 |
+
$notice = '';
|
241 |
+
$custom_total = 0;
|
242 |
+
$cat_isset = 0;
|
243 |
+
$isWithoutTax = get_option( '_pixel_cog_tax_calculating') == 'no';
|
244 |
+
|
245 |
+
$shipping = $order->get_shipping_total("edit");
|
246 |
+
$order_total = $order->get_total('edit') - $shipping;
|
247 |
+
|
248 |
+
if($isWithoutTax) {
|
249 |
+
$order_total -= $order->get_total_tax('edit');
|
250 |
+
} else {
|
251 |
+
$order_total -= $order->get_shipping_tax("edit");
|
252 |
+
}
|
253 |
+
|
254 |
+
foreach ( $order->get_items() as $item_id => $item ) {
|
255 |
+
$product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
|
256 |
+
$cost_type = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_type', true );
|
257 |
+
$product_cost = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_val', true );
|
258 |
+
|
259 |
+
$product = wc_get_product($product_id);
|
260 |
+
$args = array( 'qty' => 1, 'price' => $product->get_price());
|
261 |
+
$qlt = $item['quantity'];
|
262 |
+
|
263 |
+
if($isWithoutTax) {
|
264 |
+
$price = wc_get_price_excluding_tax($product, $args);
|
265 |
+
} else {
|
266 |
+
$price = wc_get_price_including_tax($product,$args);
|
267 |
+
}
|
268 |
+
|
269 |
+
if ($product_cost) {
|
270 |
+
$cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
|
271 |
+
$custom_total = $custom_total + ($price * $qlt);
|
272 |
+
} else {
|
273 |
+
$product_cost = get_product_cost_by_cat( $product_id );
|
274 |
+
$cost_type = get_product_type_by_cat( $product_id );
|
275 |
+
if ($product_cost) {
|
276 |
+
$cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
|
277 |
+
$custom_total = $custom_total + ($price * $qlt);
|
278 |
+
$notice = "Category Cost of Goods was used for some products.";
|
279 |
+
$cat_isset = 1;
|
280 |
+
} else {
|
281 |
+
$product_cost = get_option( '_pixel_cost_of_goods_cost_val');
|
282 |
+
$cost_type = get_option( '_pixel_cost_of_goods_cost_type' );
|
283 |
+
if ($product_cost) {
|
284 |
+
$cost = ($cost_type == 'percent') ? (float) $cost + ((float) $price * ((float) $product_cost / 100) * $qlt) : (float) $cost + ((float) $product_cost * $qlt);
|
285 |
+
$custom_total = $custom_total + ($price * $qlt);
|
286 |
+
if ($cat_isset == 1) {
|
287 |
+
$notice = "Global and Category Cost of Goods was used for some products.";
|
288 |
+
} else {
|
289 |
+
$notice = "Global Cost of Goods was used for some products.";
|
290 |
+
}
|
291 |
+
} else {
|
292 |
+
$notice = "Some products don't have Cost of Goods.";
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
|
|
|
|
297 |
|
298 |
+
return $order_total - $cost;
|
299 |
|
300 |
}
|
301 |
|
302 |
+
function getAvailableProductCogCart() {
|
303 |
+
$cart_total = 0.0;
|
304 |
+
$cost = 0;
|
305 |
+
$notice = '';
|
306 |
+
$custom_total = 0;
|
307 |
+
$cat_isset = 0;
|
308 |
+
$isWithoutTax = get_option( '_pixel_cog_tax_calculating') == 'no';
|
309 |
+
|
310 |
+
$shipping = WC()->cart->get_shipping_total();
|
311 |
+
$cart_total = WC()->cart->get_total('edit') - $shipping;
|
312 |
+
|
313 |
+
if($isWithoutTax) {
|
314 |
+
$cart_total -= WC()->cart->get_total_tax();
|
315 |
+
} else {
|
316 |
+
$cart_total -= WC()->cart->get_shipping_tax();
|
317 |
+
}
|
318 |
+
|
319 |
+
foreach ( WC()->cart->cart_contents as $cart_item_key => $item ) {
|
320 |
+
$product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] ? $item['variation_id'] : $item['product_id'] );
|
321 |
+
$cost_type = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_type', true );
|
322 |
+
|
323 |
+
$product = wc_get_product($product_id);
|
324 |
+
|
325 |
+
$args = array( 'qty' => 1, 'price' => $product->get_price());
|
326 |
+
if($isWithoutTax) {
|
327 |
+
$price = wc_get_price_excluding_tax($product, $args);
|
328 |
+
} else {
|
329 |
+
$price = wc_get_price_including_tax($product,$args);
|
330 |
+
}
|
331 |
+
$qlt = $item['quantity'];
|
332 |
+
|
333 |
+
|
334 |
+
$product_cost = get_post_meta( $product_id, '_pixel_cost_of_goods_cost_val', true );
|
335 |
+
|
336 |
+
|
337 |
+
if ($product_cost) {
|
338 |
+
$cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
|
339 |
+
$custom_total = $custom_total + ($price * $qlt);
|
340 |
+
} else {
|
341 |
+
$product_cost = get_product_cost_by_cat( $product_id );
|
342 |
+
$cost_type = get_product_type_by_cat( $product_id );
|
343 |
+
if ($product_cost) {
|
344 |
+
$cost = ($cost_type == 'percent') ? $cost + ($price * ($product_cost / 100) * $qlt) : $cost + ($product_cost * $qlt);
|
345 |
+
$custom_total = $custom_total + ($price * $qlt);
|
346 |
+
$notice = "Category Cost of Goods was used for some products.";
|
347 |
+
$cat_isset = 1;
|
348 |
+
} else {
|
349 |
+
$product_cost = get_option( '_pixel_cost_of_goods_cost_val');
|
350 |
+
$cost_type = get_option( '_pixel_cost_of_goods_cost_type' );
|
351 |
+
if ($product_cost) {
|
352 |
+
$cost = ($cost_type == 'percent') ? $cost + ((float) $price * ((float) $product_cost / 100) * $qlt) : (float) $cost + ((float) $product_cost * $qlt);
|
353 |
+
$custom_total = $custom_total + ($price * $qlt);
|
354 |
+
if ($cat_isset == 1) {
|
355 |
+
$notice = "Global and Category Cost of Goods was used for some products.";
|
356 |
+
} else {
|
357 |
+
$notice = "Global Cost of Goods was used for some products.";
|
358 |
+
}
|
359 |
+
} else {
|
360 |
+
$notice = "Some products don't have Cost of Goods.";
|
361 |
+
}
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
365 |
|
366 |
+
return $cart_total - $cost;
|
367 |
|
368 |
}
|
369 |
|
includes/functions-woo.php
CHANGED
@@ -80,94 +80,133 @@ function getWooCartSubtotal() {
|
|
80 |
|
81 |
}
|
82 |
|
83 |
-
function getWooEventValue( $valueOption, $
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
switch ( $valueOption ) {
|
122 |
-
case 'global':
|
123 |
-
$value = (float) $global;
|
124 |
-
break;
|
125 |
-
|
126 |
-
case 'cog':
|
127 |
-
$cog_value = getAvailableProductCogOrder($order_id);
|
128 |
-
($cog_value !== '') ? $value = (float) round($cog_value, 2) : $value = (float) $amount;
|
129 |
-
if ( !isPixelCogActive() ) $value = (float) $amount;
|
130 |
-
break;
|
131 |
-
|
132 |
-
case 'percent':
|
133 |
-
$percents = (float) $percent;
|
134 |
-
$percents = str_replace( '%', null, $percents );
|
135 |
-
$percents = (float) $percents / 100;
|
136 |
-
$value = (float) $amount * $percents;
|
137 |
-
break;
|
138 |
|
139 |
-
|
140 |
-
$value = (float) $amount;
|
141 |
-
}
|
142 |
|
143 |
-
|
|
|
|
|
|
|
144 |
|
145 |
-
|
|
|
|
|
146 |
|
147 |
-
|
|
|
148 |
|
149 |
-
switch ( $valueOption ) {
|
150 |
-
case 'global':
|
151 |
-
$value = (float) $global;
|
152 |
-
break;
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
$value = (float) $amount * $percents;
|
165 |
-
break;
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
170 |
|
171 |
-
|
|
|
|
|
172 |
|
|
|
173 |
}
|
80 |
|
81 |
}
|
82 |
|
83 |
+
function getWooEventValue( $valueOption, $global, $percent, $product_id,$qty ) {
|
84 |
+
|
85 |
+
$product = wc_get_product($product_id);
|
86 |
+
|
87 |
+
if(!$product) return 0;
|
88 |
+
|
89 |
+
if($valueOption == 'cog' && isPixelCogActive()) {
|
90 |
+
|
91 |
+
$args = array( 'qty' => $qty, 'price' => $product->get_price());
|
92 |
+
if(get_option( '_pixel_cog_tax_calculating') == 'no') {
|
93 |
+
$amount = wc_get_price_excluding_tax($product, $args);
|
94 |
+
} else {
|
95 |
+
$amount = wc_get_price_including_tax($product,$args);
|
96 |
+
}
|
97 |
+
|
98 |
+
$cog = getAvailableProductCog($product_id);
|
99 |
+
|
100 |
+
if ($cog['val']) {
|
101 |
+
if ($cog['type'] == 'fix') {
|
102 |
+
$value = round((float)$amount - (float)$cog['val'], 2);
|
103 |
+
} else {
|
104 |
+
$value = round((float)$amount - ((float)$amount * (float)$cog['val'] / 100), 2);
|
105 |
+
}
|
106 |
+
} else {
|
107 |
+
$value = (float)$amount;
|
108 |
+
}
|
109 |
+
return $value;
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( PYS()->getOption( 'woo_event_value' ) == 'custom' ) {
|
113 |
+
$amount = getWooProductPrice( $product_id, $qty );
|
114 |
+
} else {
|
115 |
+
$amount = getWooProductPriceToDisplay( $product_id, $qty );
|
116 |
+
}
|
117 |
+
|
118 |
+
switch ( $valueOption ) {
|
119 |
+
case 'global': $value = $global; break;
|
120 |
+
case 'percent':
|
121 |
+
$percents = (float) $percent;
|
122 |
+
$percents = str_replace( '%', null, $percents );
|
123 |
+
$percents = (float) $percents / 100;
|
124 |
+
$value = (float) $amount * $percents;
|
125 |
+
break;
|
126 |
+
default:$value = (float)$amount;
|
127 |
+
}
|
128 |
+
|
129 |
+
return $value;
|
130 |
|
131 |
}
|
132 |
+
/**
|
133 |
+
* @param $valueOption
|
134 |
+
* @param \WC_Order $order
|
135 |
+
* @param $global
|
136 |
+
* @param $order_id
|
137 |
+
* @param $content_ids
|
138 |
+
* @param int $percent
|
139 |
+
* @return float|int
|
140 |
+
*/
|
141 |
+
function getWooEventValueOrder( $valueOption, $order, $global, $percent = 100 ) {
|
142 |
+
|
143 |
+
if ( PYS()->getOption( 'woo_event_value' ) == 'custom' ) {
|
144 |
+
$amount = getWooOrderTotal( $order );
|
145 |
+
} else {
|
146 |
+
$amount = $order->get_total();
|
147 |
+
}
|
148 |
+
switch ( $valueOption ) {
|
149 |
+
case 'global':
|
150 |
+
$value = (float) $global;
|
151 |
+
break;
|
152 |
+
|
153 |
+
case 'cog':
|
154 |
+
$cog_value = getAvailableProductCogOrder($order);
|
155 |
+
($cog_value !== '') ? $value = (float) round($cog_value, 2) : $value = (float) $amount;
|
156 |
+
if ( !isPixelCogActive() ) $value = (float) $amount;
|
157 |
+
break;
|
158 |
+
|
159 |
+
case 'percent':
|
160 |
+
$percents = (float) $percent;
|
161 |
+
$percents = str_replace( '%', null, $percents );
|
162 |
+
$percents = (float) $percents / 100;
|
163 |
+
$value = (float) $amount * $percents;
|
164 |
+
break;
|
165 |
+
|
166 |
+
default: // "price" option
|
167 |
+
$value = (float) $amount;
|
168 |
+
}
|
169 |
+
|
170 |
+
return $value;
|
171 |
|
172 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
function getWooEventValueCart( $valueOption, $global, $percent = 100 ) {
|
|
|
|
|
175 |
|
176 |
+
if($valueOption == 'cog' && isPixelCogActive()) {
|
177 |
+
$cog_value = getAvailableProductCogCart();
|
178 |
+
if($cog_value !== '')
|
179 |
+
return (float) round($cog_value, 2) ;
|
180 |
|
181 |
+
if ( get_option( '_pixel_cog_tax_calculating') == 'no' ) {
|
182 |
+
return WC()->cart->cart_contents_total;
|
183 |
+
}
|
184 |
|
185 |
+
return WC()->cart->cart_contents_total + WC()->cart->tax_total;
|
186 |
+
}
|
187 |
|
|
|
|
|
|
|
|
|
188 |
|
189 |
+
if ( PYS()->getOption( 'woo_event_value' ) == 'custom' ) {
|
190 |
+
$amount = getWooCartTotal();
|
191 |
+
} else {
|
192 |
+
$amount = $params['value'] = WC()->cart->subtotal;
|
193 |
+
}
|
194 |
|
195 |
+
switch ( $valueOption ) {
|
196 |
+
case 'global':
|
197 |
+
$value = (float) $global;
|
198 |
+
break;
|
|
|
|
|
199 |
|
200 |
+
case 'percent':
|
201 |
+
$percents = (float) $percent;
|
202 |
+
$percents = str_replace( '%', null, $percents );
|
203 |
+
$percents = (float) $percents / 100;
|
204 |
+
$value = (float) $amount * $percents;
|
205 |
+
break;
|
206 |
|
207 |
+
default: // "price" option
|
208 |
+
$value = (float) $amount;
|
209 |
+
}
|
210 |
|
211 |
+
return $value;
|
212 |
}
|
includes/views/html-main-general.php
CHANGED
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
32 |
target="_blank">pro version</a>.</p>
|
33 |
</div>
|
34 |
</div>
|
35 |
-
|
36 |
<div class="row align-items-center mb-3">
|
37 |
<div class="col-3">
|
38 |
|
@@ -45,7 +45,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
45 |
); ?>
|
46 |
<?php Facebook()->render_text_area_array_item("server_access_api_token","Api token") ?>
|
47 |
<small class="form-text">
|
48 |
-
This is an experimental feature and
|
49 |
</small>
|
50 |
</div>
|
51 |
</div>
|
@@ -71,7 +71,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
71 |
<?php endif; ?>
|
72 |
<hr>
|
73 |
|
74 |
-
|
75 |
|
76 |
<?php if ( GA()->enabled() ) : ?>
|
77 |
|
32 |
target="_blank">pro version</a>.</p>
|
33 |
</div>
|
34 |
</div>
|
35 |
+
|
36 |
<div class="row align-items-center mb-3">
|
37 |
<div class="col-3">
|
38 |
|
45 |
); ?>
|
46 |
<?php Facebook()->render_text_area_array_item("server_access_api_token","Api token") ?>
|
47 |
<small class="form-text">
|
48 |
+
This is an experimental feature and works only for the WooCommerce Purchase and CompleteRegistration events, and Easy Digital Downloads Purchase event.
|
49 |
</small>
|
50 |
</div>
|
51 |
</div>
|
71 |
<?php endif; ?>
|
72 |
<hr>
|
73 |
|
74 |
+
|
75 |
|
76 |
<?php if ( GA()->enabled() ) : ?>
|
77 |
|
modules/facebook/PYSServerEventHelper.php
CHANGED
@@ -107,7 +107,7 @@ class ServerEventHelper {
|
|
107 |
* Add purchase WooCommerce Advanced Matching params
|
108 |
*/
|
109 |
|
110 |
-
if ( is_order_received_page() && isset( $_REQUEST['key'] ) ) {
|
111 |
|
112 |
$order_key = sanitize_key($_REQUEST['key']);
|
113 |
$order_id = wc_get_order_id_by_order_key( $order_key );
|
107 |
* Add purchase WooCommerce Advanced Matching params
|
108 |
*/
|
109 |
|
110 |
+
if ( PixelYourSite\isWooCommerceActive() && is_order_received_page() && isset( $_REQUEST['key'] ) ) {
|
111 |
|
112 |
$order_key = sanitize_key($_REQUEST['key']);
|
113 |
$order_id = wc_get_order_id_by_order_key( $order_key );
|
modules/facebook/facebook.php
CHANGED
@@ -393,14 +393,12 @@ class Facebook extends Settings implements Pixel {
|
|
393 |
|
394 |
// currency, value
|
395 |
if ( PYS()->getOption( 'woo_view_content_value_enabled' ) ) {
|
396 |
-
|
397 |
-
$amount = getWooProductPriceToDisplay( $post->ID );
|
398 |
-
|
399 |
$value_option = PYS()->getOption( 'woo_view_content_value_option' );
|
400 |
$global_value = PYS()->getOption( 'woo_view_content_value_global', 0 );
|
401 |
|
402 |
|
403 |
-
$params['value'] = getWooEventValue( $value_option, $
|
404 |
$params['currency'] = get_woocommerce_currency();
|
405 |
|
406 |
}
|
@@ -617,11 +615,11 @@ class Facebook extends Settings implements Pixel {
|
|
617 |
|
618 |
$params['num_items'] = $num_items;
|
619 |
|
620 |
-
|
621 |
$value_option = PYS()->getOption( 'woo_purchase_value_option' );
|
622 |
$global_value = PYS()->getOption( 'woo_purchase_value_global', 0 );
|
623 |
|
624 |
-
$params['value'] = getWooEventValueOrder( $value_option, $
|
625 |
$params['currency'] = get_woocommerce_currency();
|
626 |
//$params['transaction_id'] = $order_id;
|
627 |
$params['eventID'] = $order_id;
|
@@ -883,6 +881,7 @@ class Facebook extends Settings implements Pixel {
|
|
883 |
|
884 |
$params['currency'] = edd_get_currency();
|
885 |
$params['value'] = edd_get_payment_amount( $payment_id );
|
|
|
886 |
|
887 |
}
|
888 |
|
393 |
|
394 |
// currency, value
|
395 |
if ( PYS()->getOption( 'woo_view_content_value_enabled' ) ) {
|
396 |
+
|
|
|
|
|
397 |
$value_option = PYS()->getOption( 'woo_view_content_value_option' );
|
398 |
$global_value = PYS()->getOption( 'woo_view_content_value_global', 0 );
|
399 |
|
400 |
|
401 |
+
$params['value'] = getWooEventValue( $value_option, $global_value,100, $post->ID ,1);
|
402 |
$params['currency'] = get_woocommerce_currency();
|
403 |
|
404 |
}
|
615 |
|
616 |
$params['num_items'] = $num_items;
|
617 |
|
618 |
+
|
619 |
$value_option = PYS()->getOption( 'woo_purchase_value_option' );
|
620 |
$global_value = PYS()->getOption( 'woo_purchase_value_global', 0 );
|
621 |
|
622 |
+
$params['value'] = getWooEventValueOrder( $value_option, $order, $global_value );
|
623 |
$params['currency'] = get_woocommerce_currency();
|
624 |
//$params['transaction_id'] = $order_id;
|
625 |
$params['eventID'] = $order_id;
|
881 |
|
882 |
$params['currency'] = edd_get_currency();
|
883 |
$params['value'] = edd_get_payment_amount( $payment_id );
|
884 |
+
$params['eventID'] = $payment_id;
|
885 |
|
886 |
}
|
887 |
|
modules/facebook/function-helpers.php
CHANGED
@@ -291,12 +291,11 @@ function getWooSingleAddToCartParams( $product_id, $qty = 1 ) {
|
|
291 |
|
292 |
// currency, value
|
293 |
if ( PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_enabled' ) ) {
|
294 |
-
|
295 |
-
$amount = PixelYourSite\getWooProductPriceToDisplay( $product_id, $qty );
|
296 |
$value_option = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_option' );
|
297 |
$global_value = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_global', 0 );
|
298 |
|
299 |
-
$params['value'] = PixelYourSite\getWooEventValue( $value_option, $
|
300 |
$params['currency'] = get_woocommerce_currency();
|
301 |
|
302 |
}
|
@@ -392,12 +391,11 @@ function getWooCartParams( $context = 'cart' ) {
|
|
392 |
}
|
393 |
|
394 |
if ( PixelYourSite\PYS()->getOption( $value_enabled_option ) ) {
|
395 |
-
|
396 |
-
$amount = $params['value'] = WC()->cart->subtotal;
|
397 |
$value_option = PixelYourSite\PYS()->getOption( $value_option_option );
|
398 |
$global_value = PixelYourSite\PYS()->getOption( $value_global_option, 0 );
|
399 |
|
400 |
-
$params['value'] = PixelYourSite\getWooEventValueCart( $value_option, $
|
401 |
$params['currency'] = get_woocommerce_currency();
|
402 |
|
403 |
}
|
@@ -561,13 +559,13 @@ function getCompleteRegistrationOrderParams() {
|
|
561 |
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
|
562 |
$order = new \WC_Order( $order_id );
|
563 |
|
564 |
-
|
565 |
$value_option = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_custom_value' );
|
566 |
$global_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_global_value', 0 );
|
567 |
$percents_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_percent_value', 100 );
|
568 |
|
569 |
$params['eventID'] = $order_id;
|
570 |
-
$params['value'] = PixelYourSite\getWooEventValueOrder( $value_option, $
|
571 |
$params['currency'] = get_woocommerce_currency();
|
572 |
return $params;
|
573 |
}
|
291 |
|
292 |
// currency, value
|
293 |
if ( PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_enabled' ) ) {
|
294 |
+
|
|
|
295 |
$value_option = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_option' );
|
296 |
$global_value = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_global', 0 );
|
297 |
|
298 |
+
$params['value'] = PixelYourSite\getWooEventValue( $value_option, $global_value,100, $product_id,$qty );
|
299 |
$params['currency'] = get_woocommerce_currency();
|
300 |
|
301 |
}
|
391 |
}
|
392 |
|
393 |
if ( PixelYourSite\PYS()->getOption( $value_enabled_option ) ) {
|
394 |
+
|
|
|
395 |
$value_option = PixelYourSite\PYS()->getOption( $value_option_option );
|
396 |
$global_value = PixelYourSite\PYS()->getOption( $value_global_option, 0 );
|
397 |
|
398 |
+
$params['value'] = PixelYourSite\getWooEventValueCart( $value_option, $global_value );
|
399 |
$params['currency'] = get_woocommerce_currency();
|
400 |
|
401 |
}
|
559 |
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
|
560 |
$order = new \WC_Order( $order_id );
|
561 |
|
562 |
+
|
563 |
$value_option = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_custom_value' );
|
564 |
$global_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_global_value', 0 );
|
565 |
$percents_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_percent_value', 100 );
|
566 |
|
567 |
$params['eventID'] = $order_id;
|
568 |
+
$params['value'] = PixelYourSite\getWooEventValueOrder( $value_option, $order, $global_value, $percents_value );
|
569 |
$params['currency'] = get_woocommerce_currency();
|
570 |
return $params;
|
571 |
}
|
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.
|
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.11' );
|
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
@@ -3,8 +3,8 @@ Contributors: PixelYourSite, 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 Google Analytics, Head & Footer scripts, Enhanced Ecommerce, Pinterest tag
|
4 |
Requires at least: 3.0.1
|
5 |
Requires PHP: 5.4
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 7.1.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -391,6 +391,15 @@ NO, absolutely not! We don't track any type of data about your website. We simpl
|
|
391 |
== Changelog ==
|
392 |
|
393 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
= PixelYourSite 7.1.10 =
|
395 |
|
396 |
* Small improvements related to "Facebook for WooCommerce" ID logic.
|
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 Google Analytics, Head & Footer scripts, Enhanced Ecommerce, Pinterest tag
|
4 |
Requires at least: 3.0.1
|
5 |
Requires PHP: 5.4
|
6 |
+
Tested up to: 5.5
|
7 |
+
Stable tag: 7.1.11
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
391 |
== Changelog ==
|
392 |
|
393 |
|
394 |
+
= PixelYourSite 7.1.11 =
|
395 |
+
|
396 |
+
* FIX: Facebook Pixel server-side events token field was missing for Easy Digital Downloads.
|
397 |
+
|
398 |
+
* FIX: Possible error when [Cost of Goods](https://www.pixelyoursite.com/plugins/woocommerce-cost-of-goods) value was used for WooCommerce Facebook Pixel events.
|
399 |
+
|
400 |
+
* Wordpress 5.5 compatibility.
|
401 |
+
|
402 |
+
|
403 |
= PixelYourSite 7.1.10 =
|
404 |
|
405 |
* Small improvements related to "Facebook for WooCommerce" ID logic.
|