Shopify

Shopify

The integration of the Divvit tracking pixel for Shopify is very straightforward.

General Tracking Pixel

1

To install the generic tracking pixel you will have to modify the layout file of the theme that you are using.

Go to Online Store > Themes > Edit HTML/CSS > Layout / Theme.liquid and insert the following code somewhere underneath the opening tag:

<script type="text/javascript"> !function(){var t=window.divvit=window.divvit||[];if(t.DV_VERSION="1.0.0",t.init=function(e){if(!t.bInitialized){var i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("async",!0),i.setAttribute("src","https://tag.divvit.com/tag.js?id="+e);var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)}},!t.bInitialized){t.functions=["customer","pageview","cartAdd","cartRemove","cartUpdated","orderPlaced","nlSubscribed","dv"];for(var e=0;e<t.functions.length;e++){var i=t.functions[e];t[i]=function(e){return function(){return Array.prototype.unshift.call(arguments,e),t.push(arguments),t}}(i)}}}(); divvit.init("YOUR_FRONTEND_ID"); divvit.pageview(); </script>
Copy to clipboard

Order Tracking Pixel

1

In order to track conversions / orders with Divvit, you will need to install an additional pixel on the checkout success page.

Go to Settings > Checkout > Order processing > Additional content and scripts and add:

<script type="text/javascript"> divvit.orderPlaced({ order: { products: [ {% for line_item in line_items %} { id: "{{ line_item.sku }}", name: "{{ line_item.title | escape }}", price: "{{ line_item.line_price | money_without_currency }}", quantity: "{{ line_item.quantity }}" }, {% endfor %} ], orderId: "{{ order_number }}", total: "{{ total_price | money_without_currency }}", shipping: "{{ shipping_price | money_without_currency }}", vouchers: [ {% for discount in discounts %} { voucher: "{{ discount.code }}", voucherDiscount: "{{ discount.savings | money_without_currency }}", }, {% endfor %} ], customer: { idFields: { email: "{{ customer.email }}" }, firstName: "{{ customer.first_name }}", lastName: "{{ customer.last_name }}" } } }); </script>
Copy to clipboard

If everything is configured correctly you should see the the Divvit tracking pixel on your site. Try clearing your cache in case you cannot see the tracking pixel in your shop.