Skip to content

Instantly share code, notes, and snippets.

@cavellblood
Last active May 22, 2020 02:07
Show Gist options
  • Save cavellblood/dbf0549a40c218b97d47573e79c56e8b to your computer and use it in GitHub Desktop.
Save cavellblood/dbf0549a40c218b97d47573e79c56e8b to your computer and use it in GitHub Desktop.
<script type="text/javascript">
(function(a, b, c, d, e, f, g) {
e['ire_o'] = c;
e[c] = e[c] || function() {
(e[c].a = e[c].a || []).push(arguments)
};
f = d.createElement(b);
g = d.getElementsByTagName(b)[0];
f.async = 1;
f.src = a;
g.parentNode.insertBefore(f, g);
})('//d.impactradius-event.com/A2099494-bdbf-4af2-a2ca-eda4507067711.js', 'script', 'ire', document, window);
</script>
<script type="text/javascript">
ire('identify', {
customerid: '{{ checkout.customer.id }}',
customeremail: '{{ checkout.email | sha1 }}'
});
</script>
<script type="text/javascript">
var customerStatus = "NEW";
{% if order.customer.orders_count > 1 %}
customerStatus = "RETURNING";
{% endif %}
var promoCode = "", discountAmount = "";
{% if checkout.discounts.size > 0 %}
promoCode = "{{ checkout.discounts[0].code }}";
discountAmount = {{ checkout.discounts_amount | money_without_currency }};
{% endif %}
ire('trackConversion', 20341, {
orderId: '{{ checkout.order_number }}',
customerId: '{{ checkout.customer.id }}',
customerStatus: customerStatus,
customerEmail: '{{ checkout.email | sha1 }}',
customerCountry: '{{ checkout.shipping_address.country }}',
currencyCode: '{{ shop.currency }}',
orderPromoCode: promoCode,
orderDiscount: discountAmount,
items: [
{% for item in checkout.line_items %}
{
name: '{{ item.title }}',
sku: '{{ item.sku }}',
category: '{{ item.product.type }}',
quantity: {{ item.quantity }},
subTotal: {{ item.final_line_price | money_without_currency }},
}{% if forloop.last == false %}, {% endif %}
{% endfor %}
]
},
{
verifySiteDefinitionMatch: true
}
);
</script>
{% if first_time_accessed %}
<!-- Global site tag (gtag.js) - Google Ads: 798182953 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-798182953"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'AW-798182953');
</script>
<!-- Event snippet for Sales conversion page -->
<script>
gtag('event', 'conversion', {
'send_to': 'AW-798182953/aXzMCPqHurYBEKmczfwC',
'value': {{ checkout.total_price | money_without_currency | remove: ',' }},
'currency': '{{ shop.currency }}',
'transaction_id': '{{ order_number }}'
});
</script>
<script>
fbq('track', 'Purchase', {
value: {{ order.subtotal_price }},
currency: 'USD',
});
</script>
{% endif %}
<div class="content-box" style="margin-top:40px;">
<div class="content-box__row content-box__row--no-border">
<h2 style="text-align:center; padding-bottom:17px;">
<a href="https://farmers-friend.myshopify.com">
Continue Shopping
</a>
</h2>
</div>
</div>
<iframe style="display:none;" src="https://farmers-friend.myshopify.com/cart/clear.js"></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment