1010
1111### ` FBP_DISABLE `
1212
13- Disables the tracking code. Define it as ` true ` in ` wp-config `
13+ Disables the tracking code.
14+ Define it as ` true ` in ` wp-config ` .
15+ By default the tracking code is enabled.
1416
1517### ` FBP_FACEBOOK_RECOMMENDATION `
1618
17- Inserts the tracking code before the ending ` </head> ` tag. Defaults is before the closing ` </body> ` tag.
19+ Inserts the tracking code before the ending ` </head> ` tag.
20+ Define it as ` true ` in ` wp-config ` .
21+ Default is before the closing ` </body> ` tag.
1822
1923## Filters
2024
@@ -24,7 +28,7 @@ Disable for users with this capability. Defaults to `edit_pages`
2428
2529### ` fbp_extra_javascript `
2630
27- Add extra JavaScript code before ` fbq('track', " PageView" ); ` . Defaults to an empty string .
31+ Track custom event instead of page view. Defaults to ` fbq('track', ' PageView' ); ` .
2832
2933## Examples
3034
@@ -33,9 +37,9 @@ Adding extra JavaScript.
3337``` php
3438// Analytics.js Field Reference
3539// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
36- add_filter( 'gua_extra_javascript ', function ( $js ) {
37- $js .= "ga('set', 'anonymizeIp', true);\n";
38- $js .= "ga('set ', 'forceSSL ', true);\n" ;
40+ add_filter( 'fbp_extra_javascript ', function ( $js ) {
41+
42+ $js = sprintf( "fbq('track ', 'Purchase ', {currency: 'EUR', value: %.2f});", $cart_total ) ;
3943
4044 return $js;
4145});
@@ -44,7 +48,7 @@ add_filter( 'gua_extra_javascript', function ( $js ) {
4448Adding a Dynamic Event.
4549
4650``` js
47- ( typeof fbq === ' function' ) && fbq (' track' , ' Lead' {
51+ ( typeof fbq === ' function' ) && fbq (' track' , ' Lead' {
4852 content_name: ' Main Contact Form submit' ,
4953 referrer: document .referrer ,
5054 userAgent: navigator .userAgent ,
@@ -54,6 +58,6 @@ Adding a Dynamic Event.
5458
5559## Remarks
5660
57-
58-
5961On development sites the tracking code is not enabled, when ` WP_ENV ` is not ` production ` .
62+
63+ [ API Reference] ( https://developers.facebook.com/docs/facebook-pixel/api-reference )
0 commit comments