I'm trying to add a Facebook conversion code into the head of my pages. How do I find the <head> to these?
Hey Allen!
You would want to add this conversion code into your template editor within the theme.liquid. Shopify's template systems uses that on every page, and that's where your <head></head> code lives. You would want to add an if statement so that the code only fires on that page. Something along the lines of
{% if page.title == "Title of the Conversion page" %> FACEBOOK CONVERSION CODE {% endif %}
between the <head> </head>. Generally, putting that code right above the </head> tag would be best.
Where do I find the title of the conversion page, assuming I wanted it to be the thank you confirmation after checkout?
Hey guys, I'm still having a bit of trouble getting the facebook conversion pixel in the header of my Thank You page.
I've got the latest tracking pixel here and added the if statement you mentioned in the post above as a wrapped just about the </head> tag.
My issue is I don't know the name of the Thank You page after an order is complete to make the IF statement work. Is it just if page.title == "Thank You" ?
Any help here would be awesome.
<!-- Facebook Conversion Code for Shopify --> {% if page.title == "Title of the Conversion page" %} <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', '#############', {'value':'0.00','currency':'USD'}]); </script> <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=#############&cd[value]=0&cd[currency]=USD&noscript=1"; /></noscript> {% endif %}
Hi Areez,
2 follow up questions:
1) What's the difference between adding the script in the template.page vs. adding it to Settings > Checkout > Additional Content & Scripts.
2) I also don't know what the name of my "Thank You page" is upon checkout. This is what it looks like: http://cl.ly/W25Y and this is the URL associated: https://checkout.shopify.com/orders/2336541/232ac7c9c1670fff1e93a3a06ec3fdfd
Can you comment on both?
Thanks.
Gentlemen, the one problem that we have here is that the title of the confirmation / thank you page is the same as the other checkout: [Shop Name ]- Checkout
At least it is for ours. This is definitely laziness on Shopify's part. What other conditionals could we use other than the page title?
User | Count |
---|---|
804 | |
115 | |
91 | |
84 | |
73 |