I am trying to add Facebook conversion tracking but i cannot find the following file success.phtml
The right path it should be this one: app/design/frontent/default/default/template/checkout/success.phtml
- I couldn’t find.
Any idea?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am trying to add Facebook conversion tracking but i cannot find the following file success.phtml
The right path it should be this one: app/design/frontent/default/default/template/checkout/success.phtml
- I couldn’t find.
Any idea?
The easiest way to do this is in template\checkout\success.phtml, (pls note in your local package)
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'XXXXXXXXXX', {'value':'getBaseGrandTotal() ?>','currency':'GBP'}]);
or simply use any extensions like https://www.scommerce-mage.com/magento-facebook-conversion-audience-tracking.html
Please have a look at app/design/frontend/base/default/template/checkout/
as it is the 'new' directory where you find Magento's default template files. Nevertheless Magento would also look at your directory.
Have a look at http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy to get an understanding of the theme mechanism.
Copy success.phtml from /frontend/base/default/template/checkout/ to /frontend/defaul/default/template/checkout/
Also have a look at the below post for putting facebook conversion code in the head section for effectiveness
https://stackoverflow.com/questions/23244945/facebook-conversion-tracking-in-magento
Hope the above information helps
Cheers S
Facebook has recommended to use new Facebook Pixel since second half year of 2016, it's better to use the new script and insert them into app/design/frontend[your theme folder]\template\page\html\head.phtml
as following js snippet 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','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '590??????????');
fbq('track', "PageView");
fbq('track', 'ViewContent');
fbq('track', 'Search');
fbq('track', 'AddToCart');
fbq('track', 'AddToWishlist');
fbq('track', 'InitiateCheckout');
fbq('track', 'Purchase');
fbq('track', 'Lead');
fbq('track', 'CompleteRegistration');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=590???????????&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
If you hope to track particular page or event, you can create custom conversion by following this guide: https://www.facebook.com/business/help/780705975381000
You need to copy the file and the file structure from you base directory to your theme
From:
app / design / frontend / base / default / template / checkout / success.phtml
To:
app / design / frontend / default / yourtheme / template / checkout / success.phtml
Then modify your file with your facebook pixel.
Please refer free facebook pixel extensions with following settings.
https://www.pearlbells.co.uk/facebook-pixel-magento-extension/