close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Facebook Conversion Code

Thread began 11/25/2014 4:45 am by Nathon Jones Web Design | Last modified 11/25/2014 3:54 pm by Jason Byrnes | 694 views | 3 replies |

Nathon Jones Web Design

Facebook Conversion Code

Client has asked us to install Facebook conversion code on their checkout success pages. It looks like this:

<!-- Facebook Conversion Code for Checkout success customers -->
<script>(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', '6018866625924', {'value':'0.00','currency':'GBP'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6018866625924&amp;cd[value]=0.00&amp;cd[currency]=GBP&amp;noscript=1" /></noscript>

I've not received any instruction, apart from the code above, so I'm assuming it slots into the head section of our checkout_success.php page - please correct me if I'm wrong there - but how do I replace the 0.00 value with that of the eCart Grand Total?

It occurs twice...once in the first script section, and then in the URL that's referenced in the second script section.

Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

look like your referring to the face book conversion pixel, see this page for more details:

https://www.facebook.com/help/435189689870514/

according to that page, the code goes between the <head> and </head> tags


to write the cart grand total use:

<?php echo $cartName->GrandTotal(); ?>



where cartName is the name of the eCart object


so as an example, for this code:

window._fbq.push(['track', '6018866625924', {'value':'0.00','currency':'GBP'}]);




you would replace 0.00 with <?php echo $cartName->GrandTotal(); ?>:

window._fbq.push(['track', '6018866625924', {'value':'<?php echo $cartName->GrandTotal(); ?>','currency':'GBP'}]);
Sign in to reply to this post

Nathon Jones Web Design

Thank you Jason.

And would the URL convert from this:

https://www.facebook.com/tr?ev=6018866625924&amp;cd[value]=0.00&amp;cd[currency]=GBP&amp;noscript=1



...to this?:

https://www.facebook.com/tr?ev=6018866625924&amp;cd[value]=<?php echo $cartName->GrandTotal(); ?>&amp;cd[currency]=GBP&amp;noscript=1



Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

yes, that looks correct.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...