Skip to main content
All CollectionsTracking Implementation (direct integration only)
Implement the Klarna Creator tracking in Wix
Implement the Klarna Creator tracking in Wix
Hanna Mattsson avatar
Written by Hanna Mattsson
Updated over 6 months ago

Add the tracking script

First you need to install Google Tag Manager in order to be able to include the scripts needed. That can be done by going Settings > Tracking Analytics and adding Google Tag Manager form the New Tool button. It should be loaded on all pages. If you do not have an Tag Manager account you need to set that up first.

Once the script has been included to the site then head over to Google Tag Manager https://tagmanager.google.com/. Follow the instructions here to install the script on all pages. Just go through the instructions under Install the script tag on all pages and stop when you reach Add the Conversion tag.

Next thing is to add a trigger for the conversion data which will fire on purchase events. Click on Triggers and create a new one called purchase. The trigger type should be Custom Event and the Event Name is purchase, see image.

For all websites it's important that the cookie follow along on any redirects made between different domains. Please see separate guide to ensure this is implemented correctly: COOKIE DECOR ON REDIRECTS



Add the conversion variables

Next we need to add the variables to the tag manager. In the Tag Manager dashboard click on Variables and click User-Defined Variables > New > Data Layer Variable. We will be adding three variables in total. Here are screenshots on each one of them.

The variable for transactionId should have a Data Layer Variable Name which contains ecommerce.purchase.actionField.id.

The variable for transactionTotal should have a Data Layer Variable Name which contains ecommerce.purchase.actionField.revenue.

The variable for transactionCurrency should have a Data Layer Variable Name which contains ecommerce.purchase.products.0.currency.

Add the conversion tag

Click save and let's go back to Tags again to add a new tag which will trigger on the purchase event we created earlier and use the variables we just introduced.

Click new and select Custom HTML and add the following, name it apprlConversion. Then we reference the variables we introduced earlier. Mind the spelling!


New and correct script to add is the one here below:
โ€‹

<script> 
var APPRL = {};
APPRL.Tracking = {};
APPRL.Tracking.Sale = {};
APPRL.Tracking.Sale.order_id = '{{transactionId}}';
APPRL.Tracking.Sale.order_value = '{{transactionTotal}}';
APPRL.Tracking.Sale.currency = '{{transactionCurrency}}';
</script>
<script type="text/javascript" defer="" src="https://conversion.klarnaservices.com/kc.js"></script>

Now we have the tag which will feed the order details to our tracking script. It lacks a trigger though so we need to tell it to be included when the purchase event happens. We earlier created a trigger for just that so below the box where we included the code above we have an option to add a trigger for this tag. Select the purchase event.


To make sure that the order in which the tags are triggered are correct we will also add a setting so the script which will use the variables in the Conversion tag is fired after. When in the Conversion tag view, click Advanced Settings and click your way down to Tag Sequencing. Enter the data as in the screenshot.

Just Save & Submit and you should be good to go!

Did this answer your question?