Shopify

UTMSimple / UTM Tracker How to collect and track UTM variables via Shopify step by step

Collect UTMs after Shopify Purchase (Zapier)

Click Settings and Checkout

And copy paste the following script in "Order Status Page"

Don't forget to replace <license> with your license key and https://hooks.zapier.com/hooks/catch/111111/aaaaaaa/ with your Zapier URL.

<!-- Global site UTM Simple Tracking Start-->
<script>
handl_custom_params=[];var handl_js=document.createElement("script");handl_js.setAttribute("src","https://track.utmsimple.com/utm.js?license=<licensekey>"),document.head.appendChild(handl_js),
handl_js.onload=function(){

{% if first_time_accessed %}

  setTimeout(function(){
          all_params = HandL.getAll()
          all_params.checkout_order_unmber = "{{ checkout.order_number }}"
          all_params.checkout_id = "{{ checkout.id }}"
          all_params.checkout_email = "{{ checkout.email}}"
          all_params.checkout_total_price = "{{ checkout.total_price}}"
          all_params.checkout_customer_address1= "{{ checkout.shipping_address.address1}}"
          all_params.checkout_customer_address2= "{{ checkout.shipping_address.address2}}"
          all_params.checkout_customer_city= "{{ checkout.shipping_address.city}}"
          all_params.checkout_customer_country=" {{ checkout.shipping_address.country}}"
          all_params.checkout_customer_country_code= "{{ checkout.shipping_address.country_code}}"
          all_params.checkout_customer_first_name = "{{ checkout.shipping_address.first_name}}"
          all_params.checkout_customer_last_name = "{{ checkout.shipping_address.last_name}}"
          all_params.checkout_customer_province = "{{ checkout.shipping_address.province}}"
          all_params.checkout_customer_province_code = "{{ checkout.shipping_address.province_code}}"
          all_params.checkout_customer_street = "{{ checkout.shipping_address.street}}"
          all_params.checkout_customer_zip ="{{ checkout.shipping_address.zip}}"
          all_params.checkout_customer_phone ="{{ checkout.shipping_address.phone}}"

          {% for line in checkout.line_items %}
          all_params.checkout_product_{{ forloop.index }} ="{{ line.title }}"

          {% if line.title == 'Product Name' %}
          {% endif %}
          {% endfor %}

      Object.keys(all_params).map(function(x,y){console.log(all_params[x] = decodeURIComponent(all_params[x]))})
      var data = handlj.param(all_params)
      var xmlHttp = new XMLHttpRequest();
      xmlHttp.open( "GET", 'https://hooks.zapier.com/hooks/catch/111111/aaaaaaa/?'+data, false );
          xmlHttp.send( null );
      }, 500);
{% endif %}
};
</script>
<!-- Global site UTM Simple Tracking End-->