Skip to main content

Integrations - Shopify CDP v1 datalayer (pull)

O
Written by Optimize Team
Updated yesterday

This integration details the steps required to integrate Webtrends Optimize with Shopify's CDP, such that you can target logged-in users based on their past behaviour.

The integration is simple, leveraging Shopify's Liquid Templates.

1. Updating the theme code

Edit your theme code. Anywhere above the wt.js tag, add code similar to the below:

window.opt_data = window.opt_data || [];
opt_data.push({
user: {
id: {{ customer.id | json }},
ordersCount: {{ customer.orders_count | json }}
}
});

You can add whichever attributes you wish into this object. Some recommendations are below.

Once you're happy, save and close.

2. Suggested attributes to collect

Attribute

Description

createdAt

When the record was created, i.e. date of their first purchase. This could be extended to count "days since createdAt".

id

The unique customer ID. This is helpful if you want to target the customer with offline/scheduled imports, or stitch their behaviour back together with data collected in WTO.

orders_count

How many orders the user has purchased. Could help in identifying

orders

Listing all customer orders, so we can make logical decisions about what to show next.

total_spent

Lifetime Value (LTV) helps in assigning the customer to segments you create in WTO like "high value customers".

3. Setup in Webtrends Optimize

You may need a tweak to your tag, to allow this data to flow naturally. This will be a 1-time change, please email [email protected] to request it if you are unsure.

Once enabled, there is no additional setup required - the same data you calculate and pass into WTO can be queried directly in our segment builder:

Example of "Loyal customers segment":

4. Examples of interesting segments to create

To get you thinking - here are some examples of creative segments you could target with this data:

Loyal Customers - where the order_count is greater than N

High value customers - where total_spent is greater than N

No repeat purchases - where order_count is less than 2

Has bought x - scanning orders for a particular product or category of product.

"Needs a push" - where order_count > 3 AND time since last order > 60 days ago - i.e. they know your brand, but haven't bought in a while.

Did this answer your question?