Version Description
Download this release
Release Info
Developer | PixelYourSite |
Plugin | PixelYourSite – Facebook Pixel (Events, WooCommerce & Easy Digital Downloads) |
Version | 1.02 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.02
- facebook-pixel-master.php +39 -12
- inc/admin.php +5 -2
- inc/helper-functions.php +108 -144
- readme.txt +45 -7
facebook-pixel-master.php
CHANGED
@@ -5,23 +5,15 @@ Description: Add the Facebook Pixel code into your Wordpress site and set up sta
|
|
5 |
Plugin URI: http://www.pixelyoursite.com/free
|
6 |
Author: PixelYourSite
|
7 |
Author URI: http://www.pixelyoursite.com
|
8 |
-
Version: 1.
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
|
13 |
require_once('inc/helper-functions.php');
|
14 |
|
15 |
-
|
16 |
|
17 |
-
add_action('login_enqueue_scripts', 'woofp_pixelcode', 1);
|
18 |
-
add_action('wp_head', 'woofp_pixelcode', 1);
|
19 |
-
|
20 |
-
//add addtocart ajax support
|
21 |
-
//only if woocommerce installed
|
22 |
-
if( woofp_is_woocommerce() ){
|
23 |
-
add_action('wp_footer', 'woofp_addtocart_pixel');
|
24 |
-
}
|
25 |
|
26 |
/* Register script for front end */
|
27 |
add_action('wp_enqueue_scripts', 'tkwoofp_publicscripts');
|
@@ -34,15 +26,50 @@ add_action('admin_menu', 'woofp_adminmenu');
|
|
34 |
add_action('admin_enqueue_scripts', 'woofp_adminscripts');
|
35 |
|
36 |
//Ajax Save Admin Settings
|
37 |
-
add_action('wp_ajax_nopriv_woofbsavesettings' , 'ajax_woofbsavesettings')
|
38 |
add_action('wp_ajax_woofbsavesettings' , 'ajax_woofbsavesettings');
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
/* Plugin Front End Scripts */
|
42 |
function tkwoofp_publicscripts(){
|
43 |
|
44 |
wp_enqueue_script( 'woo-facebookpixel-script', plugins_url( 'js/public.js', __FILE__ ), array('jquery'), '1.0');
|
45 |
-
|
46 |
}
|
47 |
|
48 |
/* Register Plugin Admin Menu*/
|
5 |
Plugin URI: http://www.pixelyoursite.com/free
|
6 |
Author: PixelYourSite
|
7 |
Author URI: http://www.pixelyoursite.com
|
8 |
+
Version: 1.02
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
|
13 |
require_once('inc/helper-functions.php');
|
14 |
|
15 |
+
add_action('init', 'woofp_init');
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
/* Register script for front end */
|
19 |
add_action('wp_enqueue_scripts', 'tkwoofp_publicscripts');
|
26 |
add_action('admin_enqueue_scripts', 'woofp_adminscripts');
|
27 |
|
28 |
//Ajax Save Admin Settings
|
29 |
+
/*add_action('wp_ajax_nopriv_woofbsavesettings' , 'ajax_woofbsavesettings');*/
|
30 |
add_action('wp_ajax_woofbsavesettings' , 'ajax_woofbsavesettings');
|
31 |
|
32 |
+
add_action('wp_nopriv_fbpmpaddtocart' , 'ajax_fbpmpaddtocart');
|
33 |
+
add_action('wp_ajax_fbpmpaddtocart' , 'ajax_fbpmpaddtocart');
|
34 |
+
|
35 |
+
|
36 |
+
function woofp_init(){
|
37 |
+
|
38 |
+
//Display Facebook Pixel Code
|
39 |
+
add_action('login_enqueue_scripts', 'woofp_pixelcode', 1);
|
40 |
+
add_action('wp_head', 'woofp_pixelcode', 1);
|
41 |
+
|
42 |
+
|
43 |
+
//add addtocart ajax support
|
44 |
+
//only if woocommerce installed
|
45 |
+
if( woofp_is_woocommerce() ){
|
46 |
+
add_action('wp_footer', 'woofp_addtocart_pixel');
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
function ajax_fbpmpaddtocart(){
|
52 |
+
|
53 |
+
if( wp_verify_nonce( $_POST['nonce'], 'fbpmp_nonce_ajaxaddtocart' ) ){
|
54 |
+
|
55 |
+
$event_code = "fbq('track', 'AddToCart');";
|
56 |
+
|
57 |
+
$results = array( 'status' => 1, 'event_code' => $event_code);
|
58 |
+
|
59 |
+
} else {
|
60 |
+
|
61 |
+
$results = array('status' => 0 );
|
62 |
+
}
|
63 |
+
|
64 |
+
die( json_encode( $results ) );
|
65 |
+
}
|
66 |
+
|
67 |
|
68 |
/* Plugin Front End Scripts */
|
69 |
function tkwoofp_publicscripts(){
|
70 |
|
71 |
wp_enqueue_script( 'woo-facebookpixel-script', plugins_url( 'js/public.js', __FILE__ ), array('jquery'), '1.0');
|
72 |
+
wp_enqueue_script('jquery');
|
73 |
}
|
74 |
|
75 |
/* Register Plugin Admin Menu*/
|
inc/admin.php
CHANGED
@@ -26,6 +26,10 @@
|
|
26 |
<th scope="row"> </th>
|
27 |
<td><p><b>Important:</b> <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting.</a></p></td>
|
28 |
</tr>
|
|
|
|
|
|
|
|
|
29 |
<tr>
|
30 |
<th scope="row">Your Pixel ID:</th>
|
31 |
<td>
|
@@ -230,8 +234,7 @@
|
|
230 |
<tr>
|
231 |
<th scope="row"> </th>
|
232 |
<td>
|
233 |
-
<h2>
|
234 |
-
<p>*To Setup a "AddPaymentInfo" event go to Standard Event Setup tab and add it there. It will only work if payment page is on this server and inside WordPress.</p>
|
235 |
</td>
|
236 |
</tr>
|
237 |
<tr>
|
26 |
<th scope="row"> </th>
|
27 |
<td><p><b>Important:</b> <a href="http://www.pixelyoursite.com/facebook-pixel-plugin-help" target="_blank">Read this before starting.</a></p></td>
|
28 |
</tr>
|
29 |
+
<tr>
|
30 |
+
<th scope="row"> </th>
|
31 |
+
<td><p><b>This Super Special Offer will expire on December 16. Don't lose it, because you might need the PRO version in the future:</b> <a href="http://www.pixelyoursite.com/super-offer" target="_blank">Click Here for your huge discount</a></p></td>
|
32 |
+
</tr>
|
33 |
<tr>
|
34 |
<th scope="row">Your Pixel ID:</th>
|
35 |
<td>
|
234 |
<tr>
|
235 |
<th scope="row"> </th>
|
236 |
<td>
|
237 |
+
<h2>Super Special Offer - Will expire on December 16:</h2><a href="http://www.pixelyoursite.com/super-offer" target="_blank">Click Here to get your HUGE discount now</a>
|
|
|
238 |
</td>
|
239 |
</tr>
|
240 |
<tr>
|
inc/helper-functions.php
CHANGED
@@ -183,6 +183,10 @@ function woofp_page_event(){
|
|
183 |
$cartvalue = $woocommerce->cart->get_cart_total();
|
184 |
$currency = get_woocommerce_currency();
|
185 |
|
|
|
|
|
|
|
|
|
186 |
$cartvalue = strip_tags($cartvalue);
|
187 |
$cartvalue = preg_replace("/[^0-9\.]/", "", $cartvalue);
|
188 |
|
@@ -276,118 +280,31 @@ function woofp_is_eventadded($addedevents, $event){
|
|
276 |
|
277 |
function woofp_get_event($event='', $value=false, $currency='USD', $type=''){
|
278 |
|
279 |
-
|
|
|
280 |
|
281 |
-
|
282 |
|
283 |
-
if(
|
284 |
-
return "fbq('track', '
|
285 |
-
else
|
286 |
-
return "fbq('track', '
|
287 |
-
|
288 |
-
case 'ViewContent':
|
289 |
|
290 |
-
|
291 |
-
return "fbq('track', 'ViewContent', {value: '".$value."', currency: '".$currency."'});";
|
292 |
-
else
|
293 |
-
return "fbq('track', 'ViewContent');";
|
294 |
-
|
295 |
-
break;
|
296 |
-
|
297 |
-
case 'Search':
|
298 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
299 |
-
return "fbq('track', 'Search', {value: '".$value."', currency: '".$currency."'});";
|
300 |
-
else
|
301 |
-
return "fbq('track', 'Search')";
|
302 |
-
|
303 |
-
break;
|
304 |
-
|
305 |
-
|
306 |
-
case 'AddToCart':
|
307 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
308 |
-
return "fbq('track', 'AddToCart', {value: '".$value."', currency: '".$currency."'});";
|
309 |
-
else
|
310 |
-
return "fbq('track', 'AddToCart');";
|
311 |
-
|
312 |
-
break;
|
313 |
-
|
314 |
-
case 'ProductAddToCart':
|
315 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
316 |
-
return "fbq('track', 'AddToCart', {value: '".$value."', currency: '".$currency."'});";
|
317 |
-
else
|
318 |
-
return "fbq('track', 'AddToCart', 'AddToCart');";
|
319 |
-
|
320 |
-
break;
|
321 |
-
|
322 |
-
|
323 |
-
case 'AddToWishlist':
|
324 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
325 |
-
return "fbq('track', 'AddToWishlist', {value: '".$value."', currency: '".$currency."'});";
|
326 |
-
else
|
327 |
-
return "fbq('track', 'AddToWishlist');";
|
328 |
-
|
329 |
-
break;
|
330 |
-
|
331 |
-
|
332 |
-
case 'InitiateCheckout':
|
333 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
334 |
-
return "fbq('track', 'InitiateCheckout', {value: '".$value."', currency: '".$currency."'});";
|
335 |
-
else
|
336 |
-
return "fbq('track', 'InitiateCheckout');";
|
337 |
-
|
338 |
-
break;
|
339 |
-
|
340 |
-
|
341 |
-
case 'AddPaymentInfo':
|
342 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
343 |
-
return "fbq('track', 'AddPaymentInfo', {value: '".$value."', currency: '".$currency."'});";
|
344 |
-
else
|
345 |
-
return "fbq('track', 'AddPaymentInfo');";
|
346 |
-
|
347 |
-
break;
|
348 |
-
|
349 |
-
|
350 |
-
case 'Purchase':
|
351 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
352 |
-
return "fbq('track', 'Purchase', {value: '".$value."', currency: '".$currency."'});";
|
353 |
-
else
|
354 |
-
return "fbq('track', 'Purchase', {value: '0.00', currency: 'USD'});";
|
355 |
-
|
356 |
-
break;
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
case 'Lead':
|
361 |
-
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
362 |
-
return "fbq('track', 'Lead', {value: '".$value."', currency: '".$currency."'});";
|
363 |
-
else
|
364 |
-
return "fbq('track', 'Lead');";
|
365 |
-
|
366 |
-
break;
|
367 |
-
|
368 |
-
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
return "fbq('track', 'CompleteRegistration', {value: '".$value."', currency: '".$currency."'});";
|
373 |
else
|
374 |
-
return "fbq('track', '
|
375 |
-
|
376 |
-
break;
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
return "";
|
381 |
-
|
382 |
-
break;
|
383 |
-
}
|
384 |
}
|
385 |
|
386 |
function woofp_get_event_noscript($pixel_id, $event, $type=''){
|
387 |
|
388 |
-
return
|
389 |
-
src=
|
390 |
-
/></noscript>
|
391 |
|
392 |
}
|
393 |
|
@@ -466,9 +383,10 @@ if( !is_admin() ){
|
|
466 |
if( isset($facebookpixel['activate']) && $facebookpixel['activate'] == 1 ) {
|
467 |
?>
|
468 |
|
469 |
-
<!-- Facebook Pixel Code -->
|
470 |
|
|
|
471 |
<script>
|
|
|
472 |
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
473 |
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
474 |
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
@@ -476,15 +394,17 @@ if( isset($facebookpixel['activate']) && $facebookpixel['activate'] == 1 ) {
|
|
476 |
document,'script','//connect.facebook.net/en_US/fbevents.js');
|
477 |
|
478 |
/* pixel plugin code */
|
479 |
-
|
480 |
|
|
|
481 |
$facebookpixel_code = woofp_page_event();
|
482 |
echo $facebookpixel_code[0];
|
483 |
?>
|
|
|
|
|
484 |
/* pixel plugin code */
|
485 |
|
486 |
</script>
|
487 |
-
<?php echo $facebookpixel_code[1]; ?>
|
488 |
|
489 |
<!-- End Facebook Pixel Code -->
|
490 |
|
@@ -567,6 +487,21 @@ function woofp_addtocart_urls($woofp_options=''){
|
|
567 |
|
568 |
function woofp_addtocart_pixel(){
|
569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
//Run AddToCart Event when product are added using ajax
|
571 |
//todo: woocommerce_cart_redirect_after_add
|
572 |
|
@@ -574,52 +509,79 @@ function woofp_addtocart_pixel(){
|
|
574 |
$facebookpixel = $woofp_options['facebookpixel'];
|
575 |
$standardevent = $woofp_options['standardevent'];
|
576 |
$woocommerce_settings = $woofp_options['woocommerce'];
|
577 |
-
|
578 |
-
|
579 |
|
580 |
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
|
|
|
|
585 |
|
586 |
$php_array = woofp_addtocart_urls($woofp_options);
|
587 |
$js_array = json_encode($php_array);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
-
|
591 |
-
<script type="text/javascript">
|
592 |
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
if( current_url.indexOf(url_array[i]) !== 0 || url_array[i] == '***' ){
|
612 |
-
|
613 |
-
fbq('track', 'AddToCart');
|
614 |
-
console.log('AddToCart');
|
615 |
-
}
|
616 |
-
}
|
617 |
-
|
618 |
|
619 |
-
})
|
620 |
|
621 |
-
|
622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
<?php }
|
624 |
}
|
625 |
|
@@ -631,13 +593,15 @@ function woofp_is_woocommerce_page ($page) {
|
|
631 |
|
632 |
case 'woocommerce_view_content':
|
633 |
|
634 |
-
|
635 |
-
return true;
|
636 |
-
}
|
637 |
|
638 |
case 'woocommerce_added_to_cart':
|
639 |
|
640 |
-
|
|
|
|
|
|
|
|
|
641 |
|
642 |
break;
|
643 |
|
183 |
$cartvalue = $woocommerce->cart->get_cart_total();
|
184 |
$currency = get_woocommerce_currency();
|
185 |
|
186 |
+
$symbol = get_woocommerce_currency_symbol();
|
187 |
+
$cartvalue = str_replace($symbol, '', $cartvalue);
|
188 |
+
|
189 |
+
|
190 |
$cartvalue = strip_tags($cartvalue);
|
191 |
$cartvalue = preg_replace("/[^0-9\.]/", "", $cartvalue);
|
192 |
|
280 |
|
281 |
function woofp_get_event($event='', $value=false, $currency='USD', $type=''){
|
282 |
|
283 |
+
if( 'ProductAddToCart' == $event )
|
284 |
+
$event = 'AddToCart';
|
285 |
|
286 |
+
if( 'Purchase' == $event ){
|
287 |
|
288 |
+
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
289 |
+
return "fbq('track', '".$event."', {currency:'".$currency."', value:".$value."});";
|
290 |
+
else
|
291 |
+
return "fbq('track', '".$event."', {currency:'USD', value:0.00});";
|
|
|
|
|
292 |
|
293 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
+
if( $type == 'standardevent' && $value != false && is_numeric( $value ) )
|
296 |
+
return "fbq('track', '".$event."', {currency:'".$currency."', value:".$value."});";
|
|
|
297 |
else
|
298 |
+
return "fbq('track', '".$event."');";
|
|
|
|
|
299 |
|
300 |
+
}
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
|
303 |
function woofp_get_event_noscript($pixel_id, $event, $type=''){
|
304 |
|
305 |
+
return "<noscript><img height='1' width='1' style='display:none'
|
306 |
+
src='https://www.facebook.com/tr?id=".$pixel_id."&ev=".$event."&noscript=1'
|
307 |
+
/></noscript>";
|
308 |
|
309 |
}
|
310 |
|
383 |
if( isset($facebookpixel['activate']) && $facebookpixel['activate'] == 1 ) {
|
384 |
?>
|
385 |
|
|
|
386 |
|
387 |
+
<!-- Facebook Pixel Code -->
|
388 |
<script>
|
389 |
+
var PYS_DOMReady = function(a,b,c){b=document,c='addEventListener';b[c]?b[c]('DOMContentLoaded',a):window.attachEvent('onload',a)}
|
390 |
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
391 |
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
|
392 |
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
|
394 |
document,'script','//connect.facebook.net/en_US/fbevents.js');
|
395 |
|
396 |
/* pixel plugin code */
|
397 |
+
PYS_DOMReady(function(){
|
398 |
|
399 |
+
<?php
|
400 |
$facebookpixel_code = woofp_page_event();
|
401 |
echo $facebookpixel_code[0];
|
402 |
?>
|
403 |
+
|
404 |
+
});
|
405 |
/* pixel plugin code */
|
406 |
|
407 |
</script>
|
|
|
408 |
|
409 |
<!-- End Facebook Pixel Code -->
|
410 |
|
487 |
|
488 |
function woofp_addtocart_pixel(){
|
489 |
|
490 |
+
|
491 |
+
//
|
492 |
+
|
493 |
+
?>
|
494 |
+
|
495 |
+
<!-- noscript facebook pixel -->
|
496 |
+
|
497 |
+
<?php
|
498 |
+
$facebookpixel_code = woofp_page_event();
|
499 |
+
echo $facebookpixel_code[1];
|
500 |
+
?>
|
501 |
+
|
502 |
+
<!-- end noscript facebook pixel -->
|
503 |
+
|
504 |
+
<?php
|
505 |
//Run AddToCart Event when product are added using ajax
|
506 |
//todo: woocommerce_cart_redirect_after_add
|
507 |
|
509 |
$facebookpixel = $woofp_options['facebookpixel'];
|
510 |
$standardevent = $woofp_options['standardevent'];
|
511 |
$woocommerce_settings = $woofp_options['woocommerce'];
|
|
|
|
|
512 |
|
513 |
|
514 |
+
|
515 |
+
?>
|
516 |
+
<!-- Dynamic AddToCart when Ajax enabled on Woocommerce -->
|
517 |
+
<?php
|
518 |
+
|
519 |
+
if ( get_option( 'woocommerce_enable_ajax_add_to_cart' ) == 'yes' && ( is_woocommerce() || is_page() || is_single() ) ) {
|
520 |
|
521 |
$php_array = woofp_addtocart_urls($woofp_options);
|
522 |
$js_array = json_encode($php_array);
|
523 |
+
?>
|
524 |
+
|
525 |
+
|
526 |
+
<script type="text/javascript">
|
527 |
+
var fbpmpaddtocart_eventcode = '';
|
528 |
+
|
529 |
+
jQuery(function($){
|
530 |
+
|
531 |
+
/*$.ajax({
|
532 |
+
url: '<?php echo admin_url("admin-ajax.php"); ?>',
|
533 |
+
type: 'POST',
|
534 |
+
dataType: 'json',
|
535 |
+
data: {action: 'fbpmpaddtocart', nonce:'<?php echo wp_create_nonce("fbpmp_nonce_ajaxaddtocart"); ?>'},
|
536 |
+
})
|
537 |
+
.done(function(result){
|
538 |
|
539 |
+
if( 1 == result.status ){
|
540 |
+
fbpmpaddtocart_eventcode = result.event_code;
|
541 |
+
}
|
542 |
+
console.log(result);
|
543 |
+
console.log(fbpmpaddtocart_eventcode);
|
544 |
|
545 |
+
});*/
|
|
|
546 |
|
547 |
+
//Run AddToCart Event when product are added using ajax
|
548 |
+
jQuery(document).on( 'click', '.add_to_cart_button', function(e) {
|
549 |
+
|
550 |
+
e.preventDefault();
|
551 |
+
|
552 |
+
var current_url = jQuery(this).attr('href') || '';
|
553 |
+
var product_id = jQuery(this).attr('data-product_id') || 0;
|
554 |
+
|
555 |
+
<?php echo "var url_array = ". $js_array . ";\n"; ?>
|
556 |
+
<?php echo "var homeurl = '". home_url() . "';\n"; ?>
|
557 |
|
558 |
+
if (current_url.indexOf('http://') < 0 || current_url.indexOf('https://') < 0){
|
559 |
+
current_url = homeurl + current_url;
|
560 |
+
}
|
561 |
+
|
562 |
+
|
563 |
+
|
564 |
+
for (i = 0; i < url_array.length; i++) {
|
565 |
+
|
566 |
+
if( url_array[i] == '***' ){
|
567 |
+
|
568 |
+
|
569 |
+
fbq('track', 'AddToCart');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
|
571 |
+
} else if( current_url.search(url_array[i]) !== -1 ){
|
572 |
|
573 |
+
|
574 |
+
fbq('track', 'AddToCart');
|
575 |
+
|
576 |
+
}
|
577 |
+
|
578 |
+
}
|
579 |
+
|
580 |
+
|
581 |
+
});
|
582 |
+
|
583 |
+
});
|
584 |
+
</script>
|
585 |
<?php }
|
586 |
}
|
587 |
|
593 |
|
594 |
case 'woocommerce_view_content':
|
595 |
|
596 |
+
return is_product();
|
|
|
|
|
597 |
|
598 |
case 'woocommerce_added_to_cart':
|
599 |
|
600 |
+
if ( isset($_REQUEST['add-to-cart']) && is_numeric($_REQUEST['add-to-cart']) )
|
601 |
+
return true;
|
602 |
+
else
|
603 |
+
return false;
|
604 |
+
|
605 |
|
606 |
break;
|
607 |
|
readme.txt
CHANGED
@@ -1,31 +1,54 @@
|
|
1 |
-
=== PixelYourSite:
|
2 |
Contributors: PixelYourSite
|
3 |
-
Tags: Facebook, Facebook pixel, Facebook pixel events, tracking, standard events, Facebook events, Facebook standard events, new Facebook pixel
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.3.1
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
-
Insert
|
11 |
|
12 |
== Description ==
|
13 |
As you probably know, Facebook will retire the old Facebook Conversion Pixel in 2016. They recommend the use the Facebook Pixel for conversion tracking, optimization and remarketing. **This plugin will help you insert the pixel code on every page with just one click, setup standard events and add them value or currency**. There is an **out of the box setup for Woocommerce** that will configure all the necessary standard events for you.
|
14 |
|
15 |
-
|
|
|
|
|
16 |
|
17 |
* You can **insert the pixel on every page of your website with just a few clicks**. No need to edit any post or pages.
|
18 |
|
19 |
* You can **set up and track any type of events and you can set the value and the currency** for each event.
|
20 |
|
21 |
-
* You can **insert the Facebook pixel and start tracking events on any Woocommerce** website with just one click.
|
|
|
|
|
22 |
|
23 |
* You can **automatically track the cart value in Woocommerce for any purchase event** (Pro Version Only)
|
24 |
|
25 |
* Out of the box **Facebook Dynamic Ads** setup for your Woocommerce website (Pro Version Only)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
== Installation ==
|
31 |
* From the WP admin panel, click \"Plugins\" -> \"Add new\".
|
@@ -56,3 +79,18 @@ We maintain an up to date FAQ page on our site:
|
|
56 |
|
57 |
<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>
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== PixelYourSite: Insert Facebook Pixel and track Standard Events ===
|
2 |
Contributors: PixelYourSite
|
3 |
+
Tags: Facebook, Facebook pixel, Facebook pixel events, tracking, standard events, Facebook events, Facebook standard events, new Facebook pixel, Facebook Dynamic Ads, WooCommerce, Facebook custom events, custom events
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.3.1
|
6 |
+
Stable tag: 1.02
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
10 |
+
Insert Facebook Pixel, add standard events, or activate WooCommerce events with just a few clicks (Purchase, ViewContent, AddToCart, InitiateCheckout)
|
11 |
|
12 |
== Description ==
|
13 |
As you probably know, Facebook will retire the old Facebook Conversion Pixel in 2016. They recommend the use the Facebook Pixel for conversion tracking, optimization and remarketing. **This plugin will help you insert the pixel code on every page with just one click, setup standard events and add them value or currency**. There is an **out of the box setup for Woocommerce** that will configure all the necessary standard events for you.
|
14 |
|
15 |
+
**There is a Super Special offer for the PRO version that will exiper on December 16. You'll get more details and a secret link inside the plugin admin area.**
|
16 |
+
|
17 |
+
<p style="text-align: center;">Visit this page for <strong><a href="http://www.pixelyoursite.com/facebook-pixel-master-with-standard-events-plugin-the-free-one" target="_blank"><span style="color:#DE4D4D;">more details about how to use the plugin: Click Here</span></a></strong></p>
|
18 |
|
19 |
* You can **insert the pixel on every page of your website with just a few clicks**. No need to edit any post or pages.
|
20 |
|
21 |
* You can **set up and track any type of events and you can set the value and the currency** for each event.
|
22 |
|
23 |
+
* You can **insert the Facebook pixel and start tracking events on any Woocommerce** website with just one click (Purchase, ViewContent, AddToCart, InitiateCheckout).
|
24 |
+
|
25 |
+
* **Dynamic AddToCart** is fully supported (the AddToCart event will fire on add to cart button click).
|
26 |
|
27 |
* You can **automatically track the cart value in Woocommerce for any purchase event** (Pro Version Only)
|
28 |
|
29 |
* Out of the box **Facebook Dynamic Ads** setup for your Woocommerce website (Pro Version Only)
|
30 |
|
31 |
+
**Important**
|
32 |
+
|
33 |
+
If your testing your pixel with Pixel Helper Chrome extension you will see some **false** errors:
|
34 |
+
|
35 |
+
Facebook Pixel did not load.
|
36 |
+
Event ID: AddToCart
|
37 |
+
|
38 |
+
You can safely ignore them. It is a normal error trigger by the dynamic AddToCart event, that will disappear after you click on the add to cart button.
|
39 |
+
|
40 |
+
**What's next**
|
41 |
+
|
42 |
+
We are already testing version 1.1 of the FREE plugin, and it will be really cool:
|
43 |
+
|
44 |
+
1. You will have a lot more control over standard events, with the possibility to define every type of parameter for each of your events (value, currency, content_name, content_ids, content_type, content_category)
|
45 |
|
46 |
+
2. You will be able to define custom events on any URL of your website.
|
47 |
+
|
48 |
+
3. Search event will pass the search_string by default
|
49 |
+
|
50 |
+
|
51 |
+
<p style="text-align: center;">Visit this page for <strong><a href="http://www.pixelyoursite.com/facebook-pixel-master-with-standard-events-plugin-the-free-one" target="_blank"><span style="color:#DE4D4D;">more details about how to use the plugin: Click Here</span></a></strong></p>
|
52 |
|
53 |
== Installation ==
|
54 |
* From the WP admin panel, click \"Plugins\" -> \"Add new\".
|
79 |
|
80 |
<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>
|
81 |
|
82 |
+
== Changelog ==
|
83 |
+
PixelYourSite 1.01
|
84 |
+
|
85 |
+
- Dynamic AddToCart event for WooCommerce (the AddToCart event will trigger when a users click on the add to cart button)
|
86 |
+
- Dynamic AddToCart works with WooCommerce shortcodes.
|
87 |
+
- Fixed a false error that was reported for the Purchase WooCommerce event by Pixel Helper extension on the Thank You page.
|
88 |
+
|
89 |
+
PixelYourSite 1.02
|
90 |
+
|
91 |
+
- Fixed currency symbol error
|
92 |
+
- Added super special offer for the PRO version
|
93 |
+
|
94 |
+
== Upgrade Notice ==
|
95 |
+
Update Now!
|
96 |
+
Find out about the Super Special Offer for the PRO version of the plugin that will expire on December 16. Get your secret offer link and don't lose this deal.
|