On this page:


Overview

This guide explains how to complete the integration with Shopify by inserting a bit of code on your shop's website (in order to enable Ometria to receive interaction data).

The steps below contain instructions for both Shopify and Shopify Plus. 

Note: If you have multiple stores in one account (e.g. UK, France, Germany) you'll need to request the namespace for each store. Contact your technical project manager or support@ometria.com 


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. 


Once you've copied the javascript code, log into your store's administration panel and select Themes. 

Choose a published theme and select Template Editor.


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. Paste the code as provided during the integration between the </body> and </html> tags at the bottom of the page.

</body>
</html>

If you have multiple stores in one account (e.g. UK, France, 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:

customer_email:{{customer.email|json}},
namespace:"uk:"


If...then...
you are a Shopify user (not Shopify Plus)continue to step 3.
you are a Shopify Plus usernavigate to checkout.liquid and paste the same code between the </body> and </html> tags at the bottom of the page, then continue to step 3. 


3. Click Save


Note: You'll need to repeat steps 1 and 2 for all published themes.


4. Click on Settings from the bottom of the navigation panel on the left, then click on Checkout

Scroll down until you see the Additional Scripts box as shown on the screenshot (fig 4) below and paste the following code into the box, then press the Save button.


Note: Replace <your_site_identifier.js> with the site identifier supplied by Ometria.



<script>if (typeof ometria == 'undefined') window.ometria = {};
ometria.raw_data={template:'confirmation',order:{{order.id|json}},customer_email:{{customer.email|json}}};</script>
<script>
(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);},50);
})();
</script>

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

Example:

:{{customer.email|json}},namespace:"uk:"};</script>






Set up a subscription webhook

Overview

Ometria receives information from Shopify on which contacts are opted-in or opted-outbut it doesn't provide Ometria with the timestamp of when a contact opted out/in.

This means that if contact subscribes via your eCommerce platform they don’t have the ‘when did the contact subscribe’ information attached, and Ometria can't trigger a welcome campaign for that new subscriber. 

This is where webhooks come in.

A webhook is a way in which Shopify can talk to Ometria by sending information automatically when an event happens. 

So when a contact opts in, the webhook automatically sends the contact details with opt-in value 'true' and a time for ‘when did the contact subscribe’.  

Before you begin

Contact the Ometria support team or your technical project manager (TPM) for your webhook URL, which you need to complete the steps below.

Steps

  1. Log into your Sjopify account and go to: Settings > Notifications, then scroll down to 'Webhooks'.
  2. Select Create webhook:

3. Select the Event 'customer creation' with the Format 'JSON' and paste your webhook URL into the URL field, then select Save webhook:

4. Add a second webhook with the Event 'Customer update' and the Format 'JSON' and paste your webhook URL into the URL field, then select Save webhook: