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)

1cp 04-04-2016 11:03 AM

Facebook Pixel Code for X-Cart 4
 
I am using x-cart 4.6.3 with the reboot responsive template.

I need to install the facebook pixel code to track my ads but need help as to which file to put it in.

It needs to be pasted "between the <head> and </head> in your website code."

I'd also like to add the code for standard events, like

// ViewContent
// Search
// AddToCart
// InitiateCheckout
// Purchase
// Lead

but again, not sure which files/templates to put the code on.

Would appreciate some help. I am not a technical person, so please be as detailed as possible in your instructions.

Thanks in advance.

totaltec 04-05-2016 11:37 AM

Re: Facebook Pixel Code for X-Cart 4
 
In Reboot:
/reboot/custom/reboot_service_head.tpl

At the bottom of this file I added:
Code:

{include file="custom/facebook_tracker.tpl"}

Then I created the file:
/reboot/custom/facebook_tracker.tpl

With the content:
Code:

{literal}
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};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', 'REDACTED');
fbq('track', "PageView");
{/literal}

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

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


Of course be sure to enter your pixel code where I wrote "REDACTED" above.

1cp 04-08-2016 11:15 PM

Re: Facebook Pixel Code for X-Cart 4
 
Thank you so much!

Could you also advise me on where to put the google conversion code? the instructions say to put it on the thank you or equivalent page, between the <body</body> tags.

totaltec 04-09-2016 05:43 PM

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

Originally Posted by 1cp
Could you also advise me on where to put the google conversion code? the instructions say to put it on the thank you or equivalent page, between the <body</body> tags.

I believe you want to look in customer/main/order_message.tpl

-Mike

magicant 07-08-2016 01:40 AM

Re: Setting up Facebook conversion Tracking in Checkout??
 
Can anybody advise on the exact code to use for facebook tracking pixel on order_message ?

I am sure the code facebook provides needs altering to pickup the final values in x-cart?

Many thanks
All the best
Anthony

magicant 07-08-2016 02:08 AM

Re: Facebook Pixel Code for X-Cart 4
 
I will try this for the facebook pixel..

Does anybody know what exactly the code is I should enter for Facebook Conversion Tracking pixel into the Order_message page?

I am sure the code facebook provides needs to be amended to work and pick up the order values at the end but cannot find any instructions on how to do this.

Please can someone advise?


Many thanks
Anthony

totaltec 07-08-2016 04:41 AM

Re: Facebook Pixel Code for X-Cart 4
 
Anthony,
I'm pretty sure you need to add the goal in your Pixel setup. Can you find any documentation from FB about passing order values? I just looked and couldn't find it easily.

magicant 07-10-2016 01:36 PM

Re: Facebook Pixel Code for X-Cart 4
 
The only thing I can see in my pixel account is the following code for my pixel.. but i'm guessing the x-cart values and such must need custom code adding into the below code to make it work correctly.

I have found documentation from x-cart for version 5 for conversion but nothing anywhere for version 4.

Many thanks
Anthony

// ViewContent
// Track key page views (ex: product page, landing page or article)
fbq('track', 'ViewContent');

// Search
// Track searches on your website (ex. product searches)
fbq('track', 'Search');

// AddToCart
// Track when items are added to a shopping cart (ex. click/landing page on Add to Cart button)
fbq('track', 'AddToCart');

// AddToWishlist
// Track when items are added to a wishlist (ex. click/landing page on Add to Wishlist button)
fbq('track', 'AddToWishlist');

// InitiateCheckout
// Track when people enter the checkout flow (ex. click/landing page on checkout button)
fbq('track', 'InitiateCheckout');

// AddPaymentInfo
// Track when payment information is added in the checkout flow (ex. click/landing page on billing info)
fbq('track', 'AddPaymentInfo');

// Purchase
// Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});

// Lead
// Track when a user expresses interest in your offering (ex. form submission, sign up for trial, landing on pricing page)
fbq('track', 'Lead');

// CompleteRegistration
// Track when a registration form is completed (ex. complete subscription, sign up for a service)
fbq('track', 'CompleteRegistration');

// Other
//
fbq('track', 'Other');

totaltec 07-11-2016 05:09 AM

Re: Facebook Pixel Code for X-Cart 4
 
Anthony,
Oh I see. Yes this would need to be integrated into the order message page. I'd like to work on this for you, if you are interested drop me a line.

magicant 07-12-2016 10:00 AM

Special Facebook Pixel Code Being Minified
 
Hi Guys..

I am trying to include the exact code below.

I have setup a facebook_tracker.tpl and referenced it inside reboot_service_head.tpl

It is showing up in google chrome but not all of the pixel is loading correctly.

The tech support team from the special pixel code says the following:

========
Our developer checked your site, and it seems you've "minified" our JS file (to make it smaller). However, because of that it stopped working. Please make sure to use our original code, without minimizing it. That should do the trick!
========

If this means it is shrinking the js file how can I make sure it does not?

They explain to use the Facebook Pixel Helper Chrome plugin to detect if alright or not. it's installed at: www.magicworld.co.uk/magic-shop/

Many Thanks - can't wait to fix

Anthony

{literal}
=========PIXEL START=========
<script type='text/javascript' src='https://connectio.s3.amazonaws.com/script.js'></script><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', '175682379449572');
fbq('track', 'PageView');
/* page visit*/
fbq('trackCustom', 'connectretarget', {
magicworld_visitcounter: bpixelcookie
});
/* URL */
fbq('trackCustom', 'connectretarget', {
magicworld_URL : window.location.href
});
/*page timer*/
CR_pagetimer('connectretarget', count);
fbq('trackCustom', 'connectretarget', {
magicworld_date : now
});
fbq('trackCustom', 'connectretarget', {
magicworld_language : userLang
});
fbq('trackCustom', 'connectretarget', {
magicworld_visiting_device : device_name
});
fbq('trackCustom', 'connectretarget', {
magicworld_session_count : session_variable
});
/* page scroll */
window.onscroll = function() {
checkScroll();
};
function CR_pagescroll(event, value)
{
fbq('trackCustom', event,{
magicworld_pagescroll : value });
}
function CR_utmsource(event, value)
{
fbq('trackCustom', event,{
magicworld_utmsource : value });
}
function CR_utmmedium(event, value)
{
fbq('trackCustom', event,{
magicworld_utmmedium : value });
}
function CR_utmcampaign(event, value)
{
fbq('trackCustom', event,{
magicworld_utmcampaign : value });
}
function CR_pagetimer(event, value)
{
window.setInterval(function(){
count = count + 20;
fbq('trackCustom', event, {
magicworld_pagetimer : count
});
}, 20000);
}fbq('trackCustom', 'connectretarget', {
magicworld_source : referrer
});</script>
{/literal}


All times are GMT -8. The time now is 02:28 AM.

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