This guide explains how to complete your integration with Shopify by inserting some JavaScript on your shop's website in order to enable Ometria to receive interaction data.
Once set up, Shopify data is ingested hourly by Ometria by default.
The steps below contain instructions for both Shopify and Shopify Plus.
Before you begin: Ometria account setup link
You will have received an account setup link from Ometria detailing your integration steps.
Step 2 in this link contains some JavaScript tracking code, which you should copy before beginning the steps below.
Navigation
Once you've copied the JavaScript code, log into your store's administration panel and select Themes.
Choose a live theme and select Template Editor.
Setup steps
1. Locate the list of files (templates) in the left panel and select theme.liquid.
The contents for this template display on the right:

2. Next, paste your copied code between the </body> and </html> tags at the bottom of the page:

If you have multiple stores in one account (e.g. UK, US, Germany) and requested the namespace for each store from Ometria, you need to paste a comma ( , ) after customer_email:{{customer.email|json}} followed by the namespace you were provided (e.g. namespace:"uk:").
Example:

If... |
...then |
you are a Shopify user |
continue to step 3. |
you are a Shopify Plus user |
navigate to checkout.liquid and paste the code below between the </body> and </html> tags at the bottom of the checkout.liquid file, then continue to step 3. |
<script>
if (typeof ometria == 'undefined') window.ometria = {};
ometria.raw_data={
template: ((ometria || {}).raw_data || {}).template,
order:{{checkout.order_id |json}},
cart_total:{{checkout.total_price|json}},
cart_count:{{checkout.line_items|size}},
cart: [],
shop_currency:{{shop.currency|json}},
customer_email:{{checkout.email|json}}
};
{% for item in checkout.line_items %}
ometria.raw_data.cart.push([{{ item.product.id|json}},{{item.variant.id|json}},
{{item.quantity|json}},{{item.line_price|json}}]);
{% endfor %}
(function(){
var url=window.location.protocol+"//cdn.ometria.com/tags/<your_site_identifier>.js";
setTimeout(function(){var sc=document.createElement('script');sc.src=url;sc.setAttribute('async','true');
document.getElementsByTagName("head")[0].appendChild(sc);},15);
})();
</script>
3. Click Save.
4. Click Settings from the bottom of the navigation panel on the left, then click on Checkout:

Scroll down until you see the Additional Scripts box and paste the following code into the box:
<script>
if (typeof ometria =='undefined') window.ometria ={};
ometria.raw_data={template:'confirmation',order:{{checkout.order_id|json}}};
</script>

5. Select Save.
What’s next?
Now you’ve set up your integration, you can set up your subscription webhook.
Comments
0 comments
Article is closed for comments.