X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Facebook Pixel Code for X-Cart 4 (https://forum.x-cart.com/showthread.php?t=73804)

totaltec 07-12-2016 10:12 AM

Re: Special Facebook Pixel Code Being Minified
 
What template are you using? Reboot possibly?

magicant 07-12-2016 11:36 AM

Re: Special Facebook Pixel Code Being Minified
 
Yes Reboot - I know you offered to install but I have a programmer that I work with regularly who does all my work and this should be relatively simple... just cannot work out why it's messing up the js file in the script.

Many thanks
Anthony

cflsystems 07-12-2016 01:17 PM

Re: Special Facebook Pixel Code Being Minified
 
Because most likely the file has comments and the minimization done by reboot does not account for that so it makes the code that follow comments as well.
Or you are using the speed up tools for js and not including the custom js code with it

PhilJ 07-12-2016 01:19 PM

Re: Special Facebook Pixel Code Being Minified
 
Just place the JS code in a separate .tpl file and call it in /customer/home.tpl before </body>

masada3336 11-03-2016 11:48 AM

Re: Facebook Pixel Code for X-Cart 4
 
I've adapted Mike's code here but the pixel keeps not loading, anyone have any idea what I might be doing wrong?

Quote:

{literal}
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=f unction(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(argum ents)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', 'FACEBOOKCODEHERE');
fbq('track', "PageView");
{/literal}

{if $main eq "cart"}
fbq('track', 'InitiateCheckout');
{/if}

{if $main eq 'product'}
fbq('track', 'ViewContent');
{/if}

{if $main eq 'order_message'}
fbq('track', 'Purchase', {value: '{$orders[0].order.total}', currency: 'USD'});
{/if}

{literal}
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=FACEBOOKCODEHERE&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
{/literal}

Cart works, Product view works, all other pages work - but the order message isn't working.

Thanks in advance!

jmccunep 06-30-2017 09:08 AM

Re: Facebook Pixel Code for X-Cart 4
 
I have the same set of questions for Facebook Pixel using x-cart 4.4.5 with Ability Template.

ONE. Which is the correct header template to add an include for the custom file facebook_tracker.tpl?

TWO. Which is the correct template to add the Facebook code for tracking purchases.

Thanks in advance...

jmccunep 07-23-2017 05:08 AM

Re: Facebook Pixel Code for X-Cart 4
 
Quote:

Originally Posted by jmccunep
I have the same set of questions for Facebook Pixel using x-cart 4.4.5 with Ability Template.

ONE. Which is the correct header template to add an include for the custom file facebook_tracker.tpl?

TWO. Which is the correct template to add the Facebook code for tracking purchases.

Thanks in advance...


Answered my own question, FYI. Put an include in this template

/common_files/customer/service_head.tpl

to call this new template

/ability/custom/facebook_tracker.tpl


All times are GMT -8. The time now is 01:24 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.