Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Facebook Pixel Code for X-Cart 4
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #11  
Old 07-12-2016, 10:12 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Special Facebook Pixel Code Being Minified

What template are you using? Reboot possibly?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #12  
Old 07-12-2016, 11:36 AM
 
magicant magicant is offline
 

Advanced Member
  
Join Date: Jan 2004
Location: Manchester UK
Posts: 50
 

Default 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
__________________
X-Cart Version: 4.7.6
PHP 5.3.29
MySQL server 5.6.29
MySQL client 5.6.29
Reply With Quote
  #13  
Old 07-12-2016, 01:17 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,033
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #14  
Old 07-12-2016, 01:19 PM
  PhilJ's Avatar 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 3,439
 

Default 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>
Reply With Quote

The following user thanks PhilJ for this useful post:
totaltec (07-13-2016)
  #15  
Old 11-03-2016, 11:48 AM
 
masada3336 masada3336 is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 115
 

Default 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!
__________________
4.4.5 - with Customized Smart Template
Reply With Quote
  #16  
Old 06-30-2017, 09:08 AM
 
jmccunep jmccunep is offline
 

Advanced Member
  
Join Date: Nov 2003
Posts: 50
 

Default 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...
__________________
J McCune Porter | twinoakshammocks.com
X-Cart Gold version 4.7.8, unix server
X-Cart reBOOT Template by X-Cart Mods
Reply With Quote
  #17  
Old 07-23-2017, 05:08 AM
 
jmccunep jmccunep is offline
 

Advanced Member
  
Join Date: Nov 2003
Posts: 50
 

Default 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
__________________
J McCune Porter | twinoakshammocks.com
X-Cart Gold version 4.7.8, unix server
X-Cart reBOOT Template by X-Cart Mods
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:36 AM.

   

 
X-Cart forums © 2001-2018