Intercart Extension: Snapchat integration steps

  1. Go to Intercart > More > Integrations: Intercart Extension
  2. Click and view "Intercart Extension developer guides and samples"
  3. Check disclaimer "I have read Intercart Extension developer guides and understand the risks of Extension code."
  4. Click "Change"

   5. Replace YOUR_SNAPCHAT_UID, paste code and click Save.

The below sample tracks "Start Checkout" and "Purchase" events:

(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function()
{a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};
a.queue=[];var s='script';r=t.createElement(s);r.async=!0;
r.src=n;var u=t.getElementsByTagName(s)[0];
u.parentNode.insertBefore(r,u);})(window,document,
'https://sc-static.net/scevent.min.js');

itc.addEventHandler('InitiateCheckout', function(payload, additional) {
  snaptr('init', 'YOUR_SNAPCHAT_UID');
  snaptr('track', 'PAGE_VIEW');
  snaptr('track', 'START_CHECKOUT');
});

itc.addEventHandler('Purchase', function(payload, additional) {
  snaptr('init', 'YOUR_SNAPCHAT_UID', {'user_email': additional.email});
  snaptr('track', 'PAGE_VIEW');
  snaptr('track', 'PURCHASE', {
    currency: additional.currency,
    price: additional.total,
    transaction_id: additional.transaction_id
  });
});


 6. Verify by placing a test checkout using Funnel > Preview


If you track Pinterest using Shopify Additional Script, the below is required. Otherwise, please ignore.

Shopify Additional Script: Add filters to prevent duplicate purchase tracking

  1. Go to Shopify Settings > Checkout > Additional scripts

The below codes track "Purchase" event only, add filters for "First time visit" and "Non-Intercart order":

Replace "YOUR_SNAPCHAT_UID" , paste code and click Save.

{% if first_time_accessed %}
<script>
// check shopify order
let isIntercartOrder = false;
{% for tag in order.tags %}
  if ('{{ tag }}' === 'PoweredByIntercart') {
    isIntercartOrder = true;
  }
{% endfor %}

// execute when it is a shopify order
if (!isIntercartOrder) {
/* SNAPCHAT TRACKING CODE HERE - begin */

(function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function()
{a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments)};
a.queue=[];var s='script';r=t.createElement(s);r.async=!0;
r.src=n;var u=t.getElementsByTagName(s)[0];
u.parentNode.insertBefore(r,u);})(window,document,
'https://sc-static.net/scevent.min.js');

snaptr('init', 'YOUR_SNAPCHAT_UID', {'user_email': '{{ customer.email }}'});
snaptr('track', 'PAGE_VIEW');
snaptr('track', 'PURCHASE', {
  currency: '{{ currency }}',
  price: {{ total_price | money_without_currency }},
  transaction_id: '{{ checkout.order_name }}'
});

/* SNAPCHAT TRACKING CODE HERE - end */
}

</script>
{% endif %}


References:
https://businesshelp.snapchat.com/en-US/article/purchase-event
https://help.shopify.com/en/themes/liquid/objects/checkout
https://support.intercart.io/en/articles/3298170-update-shopify-checkout-additional-script-to-prevent-duplicate-purchase-tracking

---

Did this answer your question?