Tracking in Shopify

If you want to use the revenue tracking goal within a Shopify project, you can use the following code.
Just paste it in Shopify /admin/settings/checkout in the text area Order status page.

More info here: https://help.shopify.com/en/manual/orders/status-tracking/customize-order-status/add-conversion-tracking

On this page

Tracking Revenue

{% if first_time_accessed %}
<script type="text/javascript">
window['ablyft'] = window['ablyft'] || [];
window['ablyft'].push({
  eventType: 'revenue',
  eventName: 'revenue',
  eventValue: {{ total_price | divided_by: 100.0 }} // or subtotal_price, if wanted
});
</script>
{% endif %}

Tracking Purchases

{% if first_time_accessed %}
<script type="text/javascript">
    window['ablyft'] = window['ablyft'] || [];
    window['ablyft'].push({
        eventType: 'custom',
        eventName: 'purchase', //use your own api name here
    });
</script>
{% endif %}

Tracking Amount of Products

{% assign products_count = 0 %}
{% for line_item in line_items %}
{% capture products_count %}{{ products_count | plus: line_item.quantity }}{% endcapture %}
{% endfor %}
{% if first_time_accessed %}
<script type="text/javascript">
window['ablyft'] = window['ablyft'] || [];
window['ablyft'].push({
  eventType: 'custom',
  eventName: 'products-count', //use your own api name here
  eventValue: {{ products_count }}
});
</script>
{% endif %}

Troubleshooting

If the there is no data in your reports, but the targeting etc. seems to be correct (users are counted) check to following:

  1. Enable the Debug Mode in "Project > Settings" and check (in the browser's console) if everything is working as expected.
  2. In some themes it could be necessary to add the basic snippet of ABlyft (find in "Project > Snippet") even in the tracking snippets section in Shopify.