Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

<!-- Global site tag (gtag.

js) - Google Ads: 123456789 -->


<script async src="https://www.googletagmanager.com/gtag/js?id=AW-10835778873"></
script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
<!-- Event snippet for dynamic remarketing -->
gtag('config', 'AW-10835778873');
</script>
{% if template contains 'index' %}
<script>
gtag('event', 'page_view', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': ‘home’
});
</script>
{% elsif template contains 'collection' %}
<script>
gtag('event', 'view_item_list', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': 'category'
});
</script>
{% elsif template contains 'product' %}
<script>
gtag('event', 'view_item', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': 'product',
'ecomm_prodid': '{{ product.id }}',
'ecomm_totalvalue': '{{ product.price | money_without_currency | remove: ',' }}'
});
</script>
{% elsif template contains 'cart' %}
<script>
gtag('event', 'view_cart', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': 'cart',
'ecomm_prodid': [{% for item in cart.items %}'{{item.product.id}}'{% unless
forloop.last %},{% endunless %}{% endfor %}],
'ecomm_totalvalue': '{{cart.total_price | money_without_currency | remove: ',' }}'
});
</script>
{% elsif template contains 'search' %}
<script>
gtag('event', 'view_search_results', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': 'searchresults'
});
</script>
{% else %}
<script>
gtag('event', 'page_view', {
'send_to': 'AW-10835778873',
'ecomm_pagetype': 'other'
});
</script>
{% endif %}

You might also like