Ready to give your email marketing a boost with Heyloyalty tracking? In this guide, we’ll walk you through what it takes to get started with tracking on your website.
The value of tracking
More personalized communication
Tracking makes it possible to collect data about customer behavior on your online store so you can send more relevant and personalized messages based on their interests, product views and purchase history.
Automation based on behavior
Once tracking is implemented, you can enable automatic flows such as lost basket, product interest and category triggers. This makes it possible to automatically respond to customer actions and create more valuable customer experiences.
Better segmentation
Tracking data provides a stronger data foundation for segmentation. You can build audiences based on behavior, categories visited, product interests and purchases to make your campaigns more targeted and relevant.
Increased conversion
By working with behavioral marketing, you can target customers at the right time with the right message. This can help increase engagement, conversions and repeat purchases.
Insight into customer behavior
Tracking gives you insight into how customers move around your webshop. Through Heyloyalty’s Insight and Activity feed, you can see which products and categories are most visited and use that knowledge to optimize your communication and marketing.
A stronger data foundation in Heyloyalty
When tracking is set up correctly, Heyloyalty’s data warehouse is continuously enriched with behavioral data from your website. This provides a stronger foundation for automations, segmentation and analytics across the customer journey.
Tracking is therefore a central part of working in a data-driven way with email marketing and automated communication in Heyloyalty.
Step 1: Create a tracking integration
Set up Tracking by clicking Integrations → List integrations → Tracking → Setup integration → Create new Tracking.


This takes you to the integration page, where you need to configure various settings, as you can see in the image below:

Here is what the different fields/settings mean:
- List: Select which list to associate the integration with. Tracking will only be applied to the list selected in the integration.
- Session time: Must be a number, and it must be the same as in your script. We typically recommend 45 minutes, so if you follow that recommendation, enter 45 in that field. Also select a product feed to associate with the integration.
- Image format: Choose the format of your product images. If in doubt, leave it on portrait. The image format is used, among other things, to set up a lost basket.
- Product feed: Choose which feed the integration should use. Among other things, this determines which products your tracking takes data from.
- Abandoned cart type: There are two options here:
- Abandoned cart ID: In most cases, you should select this option, as most online stores support unique basket IDs in the URL. Your online shop will generate a unique link to the lost cart, for example: www.dinURL.dk/basket/?basketnumber=29fSc-df2s. In the example above, a unique basket ID is inserted after
=. Heyloyalty uses this ID to recreate the customer’s cart. - Product: If your online store doesn’t support lost cart IDs, the cart can instead be recreated via product parameters in the URL. This is done by adding product information to the lost cart URL, for example:
www.dinURL.dk/?ProductID=154Ds&amount=1&productID=98DWC&amount=3
In the example above, two products have been added to the URL. Each product contains:- productID = product ID
- amount = quantity of the product in the basket
- Abandoned cart ID: In most cases, you should select this option, as most online stores support unique basket IDs in the URL. Your online shop will generate a unique link to the lost cart, for example: www.dinURL.dk/basket/?basketnumber=29fSc-df2s. In the example above, a unique basket ID is inserted after
- Abandoned cart url: Here, insert the URL of the basket page in your online shop. It will often be something like: www.dinwebshop.dk/kurv or www.webshop.dk/basket.
- Characters that divide categories: Refers to your product feed, i.e. how the categories are divided in your product feed. If you don’t have categories in your product feed, you can set it to None.
If you have selected a Google Shopping Feed, select > (Google product category). Find the right format in your product feed. - Number of visits of category: Specify how many times a member must visit a category before a category interest automation is triggered.
- Number of days visits exceed: Specify the number of days over which the visits must take place to trigger a category interest automation.
- Disable UTM_content parameter: If you want to use our default, set it to no. If you want to control your utm_content parameter via your custom content template, select ‘Yes’ to disable utm_content.
- Unique id by session: When a session ends with a purchase, Heyloyalty needs a unique ID to recognize the purchase. For most webshops, this will be the order_number.
If you use a different ID to recognize purchases, such as booking ID, select the appropriate option. If the ID has a different name, select Custom field and enter the field name.
Once all the settings above are in place, you can save the integration.
Step 2: Implement Tracking on the webshop
For tracking to work on your webshop, data must be sent to Heyloyalty. This is done by implementing a JavaScript snippet that sends tracking data to Heyloyalty.
Implementation is often done by a developer or IT manager. You can find our tracking documentation here.
Implement the tracking script on the webshop
You can find the tracking script here. We recommend inserting the script on all pages of the webshop. It therefore often makes sense to place it in either the header or the footer.
To implement the script, you need to insert some parameters into it. These are marked in the image:

- API key: Found under Account information in your Heyloyalty account
- Session time: The value you selected when setting up the tracking integration. Found under Integrations → List integrations → Tracking.
- Tracking ID: Found under Integrations → List integrations → Tracking. Used if the tracking should only apply to one specific list.
If the tracking should apply to multiple lists, leave the field empty.
Step 3: Fire events from the right webshop pages
If your Heyloyalty integration does not automatically fire the triggers below, you can add them yourself on the webshop.
If you can already see events in the Activity Feed in Heyloyalty, you can skip this section.
Events should be placed within a <script> tag, which could be the same script as above. Add events to the relevant pages in the webshop and make sure that each event is only fired from the correct page.
Available events
- hlt.visit(PRODUCTID, CATEGORYID, CATEGORYNAME, VARIANT) – Fired from all pages except the “thank you for your purchase” page. Used on product pages, category pages, blog posts, etc. You can read more about visit events in our documentation here.
- hlt.addToBasket(PRODUCTID, AMOUNT, CATEGORYID, BASKETID, CATEGORYNAME, VARIANT) – Fired from the cart page or from each “add to cart” button. You can read more about addToBasket events in our documentation here.
- hlt.updateBasket – Used if the number of products in the basket changes. You can read more about update events in our documentation here.
- hlt.removeFromBasket(PRODUCTID) – Fired when a product is removed from the basket. You can read more about remove events in our documentation here.
- hlt.purchasedBasket(BASKETPRICE, ORDERNUMBER) – Fired from the “thank you for your purchase” page after the purchase is complete. You can read more about purchase events here.
- hlt.pairEmail(EMAIL) – Optional, pairs the email address directly from a sign-up/sign-in form. You can read more about this here.
- hlt.pairPhone(“PHONENUMBER”) – Optional, pairs the phone number with the session in the tracking. You can read more about this here.
Pairing directly from a sign-up/login form
To track which contacts perform the different actions on your website, you need to make sure that the contact is paired. When implementing tracking, you can add the pairEmail event to your own forms or use the extended script to ensure Heyloyalty forms pair customers instantly.
Here you can read how to use our extended tracking script, which has the pairing built into the script.
We use pair-on-click on every email or SMS sent from Heyloyalty. Every time a customer clicks and is taken to your website, the pairEmail event is automatically triggered.
Setting up Tracking for Multi-shop
If you have multiple webshops that need the same script but different tracking databases, use the script below. Remember to replace webshopnoX with your domains and integrationIDX with your tracking IDs.
<script>
var currentDomain = window.location.hostname;
switch (currentDomain) {
case 'webshopno1':
trackingId = 'integrationID1';
break;
case 'webshopno2':
trackingId = 'integrationID2';
break;
case 'webshopno3':
trackingId = 'integrationID3';
break;
default:
trackingId = 'integrationID1';
}
</script>
<script type="text/javascript" language="javascript">
var hlt;
var BiTrackingLoaded = function (BiTracking) {
hlt = BiTracking;
BiTracking.initialize('INSERTAPIKEYHERE', INSERTSESSIONTIMEHERE, String(trackingId));
hlt.visit("PRODUCTID", "CATEGORYID", "CATEGORYNAME");
}
</script>
<script>
(function (d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
h = "https:" == document.location.protocol ? "https://" : "http://";
g.src = h + 'tracking.heycommerce.dk/hlbi.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
</script>
You are ready to use Tracking
You have now activated Tracking, implemented the script on your webshop and set up the list-level integration in Heyloyalty. This means that you can now track your members’ behavior and actively use data such as visited categories, lost baskets and product interests in your email marketing.
The next step is to start using the many tracking triggers. They are used in our flows – for example, a lost basket flow or a category interest automation that sends relevant emails based on your customers’ actual behavior. Have a great experience!

If you need information or help that you cannot find here on the guide site, you are always welcome to contact our support!
support@heyloyalty.com