Skip to content

Instantly share code, notes, and snippets.

@michelarteta
Created July 6, 2020 14:31
Show Gist options
  • Save michelarteta/f9118d06f9390b2e2a89ef597926e3c8 to your computer and use it in GitHub Desktop.
Save michelarteta/f9118d06f9390b2e2a89ef597926e3c8 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
!function(e){if(!window.pintrk){window.pintrk=function()
{window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
n=window.pintrk;n.queue=[],n.version="3.0";var
t=document.createElement("script");t.async=!0,t.src=e;var
r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}
("https://s.pinimg.com/ct/core.js");
pintrk('load','{{tag_id}}', { em: '{{ customer.email }}', });
pintrk('page');
</script>
{% if first_time_accessed %}
<script>
pintrk("track", "checkout",{
value: {{ order.total_price | money_without_currency }},
currency: "{{ shop.currency }}",
order_quantity: 1,
order_id: {{ checkout.id }},
line_items: [
{% for line_item in order.line_items %} {
product_name: "{{ line_item.product.title }}",
product_id: "{{ line_item.product.id }}",
product_category: "{{ line_item.product.type }}",
product_variant_id: "{{ line_item.variant.id }}",
product_variant: "{{ line_item.variant.title }}",
}
{% endfor %}
]
});
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="pinterest pixel" src="https://ct.pinterest.com/v3/?tid={{tag_id}}&event=checkout&noscript=1"/>
</noscript>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment