Search code examples
bigcartel

Passing Order Value to conversion code in Success page


I'm implementing Google Dynamic Remarketing code for 'success' page and I would like to pass order data to tracking script -

Is it doable? I don't see any Order variables in documentation. Would shopify order variables work?

Script I need to populate and pass -

<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: [PRODUCT IDs],
ecomm_pagetype: 'purchase',
ecomm_totalvalue: ORDER TOTAL
};
</script>

Script I use in Shopify Order Success -

<script type="text/javascript">
var google_tag_params = {
{% if order.line_items.size > 1 %}
ecomm_prodid: [{% for line_item in order.line_items %}'{{line_item.product.product.id }}'{% if forloop.last != true %},{% endif %}{% endfor %}],
{% elsif order.line_items.size == 1 %}
ecomm_prodid: [{% for line_item in order.line_items %}'{{line_item.product.product.id }}'{% endfor %}],
{% else %}
ecomm_prodid: '',
{% endif %}
ecomm_pagetype: 'purchase',
ecomm_totalvalue: {{ cart.total }}
};
</script>

Please advise.

Thanks


Solution

  • Sorry, but at the moment there's no way to pass any kind of order details to the Success page - unfortunately this type of code isn't going to work.