tl;dr
Do you want to start using the attribution report in Klar? Great choice 🎉
Setting up the Klar Pixel takes a few minutes and involves five steps:
Add the Klar Pixel datasource in Klar and choose Domain Validated (recommended) or Basic tracking
Validate your domain via two DNS records with your hosting provider
Implement the tracking script in Shopify Customer Events
Add URL parameters to your ad accounts so conversions and costs can be matched
Add the data privacy snippet to your data privacy policy if needed.
If you have multiple Shopify stores with separate domains, create a separate Klar Pixel datasource for each.
1️⃣ Add the Klar Pixel datasource
If you have multiple Shopify instances, with separate domains, connected to Klar, you should create a unique Pixel datasource for each of these stores.
Go to Store Configurator → Data Sources and click Add New Data Source
Select Klar Pixel
Enter a name (e.g.
Klar Pixel DE)Select Shopify as your Shop System
Choose your tracking type:
Domain Validated Pixel (recommended) — you set up a subdomain for your shop's domain with your DNS provider, and Klar delivers the Attribution JavaScript via that subdomain. This leads to more tracked conversions because some browsers block third-party JavaScripts by default
Basic Tracking Script — a third-party script, simpler to set up but less accurate
6. If you selected Basic Tracking Script, skip ahead to Step 3 — your script is already available
7. If you selected Domain Validated Pixel, enter your domain name (exclude https:// and www.), then click Configure
2️⃣ Validate your domain (Domain Validated only)
Klar will show two DNS records that you need to add to your hosting provider's DNS settings.
Shopify, WebGo, All Inkl, Strato users: When adding the DNS records, remove your domain from the Name field. Only enter the numeric prefix.
Correct format:
Record type | Wrong ❌ | Correct ✅ |
CNAME |
|
|
CNAME IPv4 |
|
|
Copy and paste the two DNS records into your hosting provider's DNS settings using the copy icon next to each field
Click Validate DNS Records
⚠️ Note: DNS propagation can take anywhere from a few hours to 2 days. Once verified, a green check icon appears next to each record. If you're unsure how to add DNS records, reach out via the support chat — we're happy to help.
Once both records are validated, the Tracking Script appears in the datasource. Copy it for the next step.
3️⃣ Implement the tracking script in Shopify
Remove any existing Klar Pixel code first to avoid double-counting. Check these locations:
theme.liquidcheckout.liquid(Shopify Plus only)Additional scripts in your checkout settings
3.1 Standard Shopify store
Click Copy Script in the Klar Pixel datasource
In your Shopify Admin, go to Settings → Customer Events
Click Add Custom Pixel
Give the pixel a unique name (e.g.
Klar!)Delete the default code in the Code window and adjust the privacy settings
Paste your Klar Pixel Customer Events JavaScript into the Code window
Click Save, then click Connect Pixel to activate tracking
⚠️ Note: Shopify Customer Events only fire when the user has accepted the cookie banner — provided a Shopify-compatible cookie solution is in place.
3.2 Shopify Markets with multiple top-level domains
If you use Shopify Markets with multiple TLDs (e.g. shop.de and shop.co.uk):
Create a separate Domain Validated Pixel datasource for each TLD
Replace the standard script with this multi-domain script, updating the
getPixelDomain()function with your actual pixel URLs:
function getTLD() {
const hostname = window.location.hostname;
const parts = hostname.split('.');
if (parts.length > 1) {
return parts.slice(-2).join('.');
} else {
return null;
}
}
function getPixelDomain() {
const domain = getTLD();
switch (domain) {
case "domain-a.de":
return "123456789.domain-a.de"; // Address for Domain #1
case "domain-b.de":
return "987654321.domain-b.de"; // Address for Domain #2
default:
return "987654321.domain-b.de"; // Default fallback
}
}
const script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = 'https://' + getPixelDomain() + '/javascript/script.js';
document.getElementsByTagName('script')[0].parentNode.appendChild(script);
window._k_s_c_e = true;
window._k_s_c_e_i = init;
window._k_s_c_e_b = browser;
window._k_s_c_e_s = api.settings;
analytics.subscribe('all_events', (event) => {
window._k_s_q = window._k_s_q || [];
window._k_s_q.push(['Shopify:allEvents', event]);
});
You only need to modify the getPixelDomain() function — the rest of the script stays the same:
function getPixelDomain() {
const domain = getTLD();
switch (domain) {
case "domain-a.de":
return "123456789.domain-a.de"; // Address for Domain #1
case "domain-b.de":
return "987654321.domain-b.de"; // Address for Domain #2
default:
return "987654321.domain-b.de"; // Default fallback
}
}
For each additional TLD, add a new case to the switch statement with the corresponding pixel subdomain.
4️⃣ Add the Data Privacy snippet
Add the Klar Data Privacy snippet to your privacy policy to inform customers about the Klar Pixel. You'll find a German and English version inside the Klar Pixel datasource, under the tracking script in the collapsed Data Protection Snippet section.
5️⃣ Implementing Klar URL Parameters
To ensure that conversions and costs can be matched as accurately as possible, you need to implement the pre-defined Klar tracking codes in your ad accounts.
Here are guides on how to do that for each marketing channel:
What happens next?
From now on, Klar tracks visitors and purchase activity on your site. Data will appear in your Attribution reports from the next day onwards — historical data before the script was added is not available.
🎉 Your Klar Pixel is live — you're ready to start using the Attribution reports!










