Integrating Trusted Shops into Your Shoptet Store
Overview
This guide explains how to set up the Trusted Shops integration in your Shoptet online store. Because Shoptet does not allow direct access to the store's source code, the integration is done through Google Tag Manager (GTM) — a free tool by Google that lets you add scripts and tracking elements to your website without coding.
The integration enables two things:
- The Trusted Shops badge (Trustbadge) is displayed in your store.
- After a customer completes an order, Trusted Shops can send them a review invitation and offer buyer protection.
Before you begin, make sure you have: - An active Trusted Shops account
- A Google Tag Manager account with a container created for your store
- GTM already connected to your Shoptet store (see Step 1)
Step 1 — Connect Google Tag Manager to Your Shoptet Store
If you have not yet connected GTM to your Shoptet store, follow these steps:
- Log in to your Shoptet administration.
- In the left menu, navigate to Connections → Google → Tag Manager.
- Enter your GTM Container ID. This is a code in the format GTM-XXXXXXX, which you can find in your GTM account in the top right corner next to your container name.
- Save the settings.
Once saved, GTM will start loading on all pages of your store. You can verify this is working correctly using the Preview function in GTM.
Step 2 — Create Triggers in Google Tag Manager
Triggers tell GTM when each script should run. You need to create three triggers. All three use the same trigger type: Window Loaded. This ensures the page is fully loaded before the scripts execute.
To create a trigger in GTM:
- In your GTM workspace, click Triggers in the left menu.
- Click New.
- Click the Trigger Configuration area and select Window Loaded as the trigger type.
- Under This trigger fires on, select Some Windows.
- Set the condition as described for each trigger below.
- Name the trigger and click Save.
Trigger 1: Trusted Shops - All pages
This trigger fires on every page of your store except the order confirmation page.
| Setting | Value |
|---|---|
| Name | Trusted Shops: All pages |
| Trigger Type | Window Loaded |
| Fires on | Some Windows |
| Condition | Page URL — does not contain — [thank you URL] |
Replace [thank you URL] with the correct value for your store's language (see the URL Reference table at the end of this guide).
Trigger 2: Trusted Shops - Thank you page
This trigger fires only on the order confirmation page, which the customer sees after completing their purchase.
| Setting | Value |
|---|---|
| Name | Trusted Shops - Thank you page |
| Trigger Type | Window Loaded |
| Fires on | Some Windows |
| Condition | Page URL — contains — [thank you URL] |
Replace [thank you URL] with the correct value for your store's language (see the URL Reference table at the end of this guide).
Trigger 3: Trusted Shops - Order data
This trigger fires on the second step of the checkout process, where the customer enters their contact details and reviews their order. At this point, the integration quietly saves the customer's email address and product links in the background, ready to be used on the confirmation page.
| Setting | Value |
|---|---|
| Name | Trusted Shops - Order data |
| Trigger Type | Window Loaded |
| Fires on | Some Windows |
| Condition | Page URL — contains — [checkout step 2 URL] |
Replace [checkout step 2 URL] with the correct value for your store's language (see the URL Reference table at the end of this guide).
Step 3 — Create Data Layer Variables in Google Tag Manager
Variables allow GTM to read order information — such as the order number and total amount — from Shoptet and pass it to the Trusted Shops scripts. You need to create four variables.
To create a variable in GTM:
- In your GTM workspace, click Variables in the left menu.
- Under User-Defined Variables, click New.
- Click the Variable Configuration area and select Data Layer Variable.
- Enter the Data Layer Variable Name exactly as shown in the table below.
- Name the variable exactly as shown and click Save.
| Variable Name | Data Layer Variable Name |
|---|---|
| tsCheckoutAllProductsArray | shoptet.order.content |
| tsCheckoutOrderAmount | shoptet.order.total |
| tsCheckoutOrderCurrency | shoptet.currency |
| tsCheckoutOrderNr | shoptet.order.orderNo |
Important: Both the variable name and the data layer variable name must be entered exactly as written above, including capitalisation. Any difference will cause the integration to stop working.
Step 4 — Create Tags in Google Tag Manager
Tags are the actual scripts that run in your store. You need to create three tags, all of type Custom HTML.
To create a tag in GTM:
- In your GTM workspace, click Tags in the left menu.
- Click New.
- Click the Tag Configuration area and select Custom HTML.
- Enter the name, paste the script, and configure the settings as described for each tag below.
- Click the Triggering area and assign the correct trigger.
- Click Save.
Tag 1: Trusted Shops – Trustbadge
This tag loads the Trusted Shops badge on every page of your store.
| Setting | Value |
|---|---|
| Name | Trusted Shops - Trustbadge |
| Tag Type | Custom HTML |
| Trigger | Trusted Shops - All pages |
| Support document.write | Yes (enable this checkbox) |
For the tag body (the script to paste in), you need to get the code from the Trusted Shops help centre. The script contains your unique shop ID and is specific to your account.
Where to find it:
Go to the following Trusted Shops article: "How can I integrate the Trustbadge® in my website without a plugin?"
On that page, locate Step 2 and copy the complete script shown there with your shop’s TSID (you will have received the TSID from your contact person at Trusted Shops at the beginning of your contract). Paste it as the tag body in GTM.
Tag 2: Trusted Shops - Order data
This tag runs on the second step of the checkout. It saves the customer's email address and the URLs of the products in the order so that this information is available on the confirmation page.
| Setting | Value |
|---|---|
| Name | Trusted Shops – Order data |
| Tag Type | Custom HTML |
| Trigger | Trusted Shops – Order data |
| Support document.write | No |
Tag body — paste the following script exactly as written:
<script>
(function() {
var emailInput = document.querySelector('#email');
if (emailInput) {
window.sessionStorage.setItem('tsCheckoutBuyerEmail', emailInput.value);
emailInput.addEventListener('blur', function() {
window.sessionStorage.setItem('tsCheckoutBuyerEmail', emailInput.value);
});
}
var cartItems = document.querySelectorAll('#checkoutSidebar .cart-item');
var productUrls = [];
cartItems.forEach(function(item) {
var sku = item.dataset.microSku || '';
var linkElement = item.querySelector('.main-link');
var url = linkElement ? linkElement.href : '';
productUrls.push({ sku: sku, url: url });
});
window.sessionStorage.setItem('tsCheckoutProductUrls', JSON.stringify(productUrls));
})();
</script>
Tag 3: Trusted Shops – Checkout
This tag runs on the order confirmation page. It assembles all the order information — order number, customer email, total amount, currency, and product details — and places it on the page in a format that Trusted Shops can read. This is what triggers the review invitation and buyer protection flow.
| Setting | Value |
|---|---|
| Name | Trusted Shops - Checkout |
| Tag Type | Custom HTML |
| Trigger | Trusted Shops - Checkout |
| Support document.write | Yes (enable this checkbox) |
| Tag Sequencing | Enable "Cleanup Tag" and select: Trusted Shops - Trustbadge |
Note on Tag Sequencing: The cleanup tag setting ensures that the Trustbadge script loads after the order data has been placed on the page. Without this, Trusted Shops may not be able to read the order information correctly. To configure it, open the tag, go to the Advanced Settings section, expand Tag Sequencing, check the box for "Fire a tag after [tag name] fires" and select Trusted Shops - Trustbadge.
Tag body — paste the following script exactly as written:
<script>
(function() {
var sessionStorage = window.sessionStorage;
var buyerEmail = sessionStorage.getItem('tsCheckoutBuyerEmail');
var productUrls = JSON.parse(sessionStorage.getItem('tsCheckoutProductUrls') || '[]');
sessionStorage.removeItem('tsCheckoutBuyerEmail');
sessionStorage.removeItem('tsCheckoutProductUrls');
var container = document.createElement('div');
container.id = 'trustedShopsCheckout';
container.style.display = 'none';
function addSpan(parent, id, value, isClass) {
var span = document.createElement('span');
if (isClass) {
span.className = id;
} else {
span.id = id;
}
span.textContent = value || '';
parent.appendChild(span);
return span;
}
addSpan(container, 'tsCheckoutOrderNr', {{tsCheckoutOrderNr}});
addSpan(container, 'tsCheckoutBuyerEmail', buyerEmail);
addSpan(container, 'tsCheckoutOrderAmount', {{tsCheckoutOrderAmount}});
addSpan(container, 'tsCheckoutOrderCurrency', {{tsCheckoutOrderCurrency}});
addSpan(container, 'tsCheckoutOrderPaymentType', 'OTHER');
var baseUrl = window.location.protocol + '//' + window.location.host;
var list = {{tsCheckoutAllProductsArray}};
list.forEach(function(product) {
var productUrlEntry = productUrls.find(function(entry) {
return entry.sku == product.sku;
});
var productUrl = (productUrlEntry && productUrlEntry.url) ? productUrlEntry.url : baseUrl;
var item = document.createElement('span');
item.className = 'tsCheckoutProductItem';
addSpan(item, 'tsCheckoutProductUrl', productUrl, true);
addSpan(item, 'tsCheckoutProductImageUrl', '', true);
addSpan(item, 'tsCheckoutProductName', product.name, true);
addSpan(item, 'tsCheckoutProductSKU', product.sku, true);
addSpan(item, 'tsCheckoutProductGTIN', '', true);
addSpan(item, 'tsCheckoutProductBrand', '', true);
container.appendChild(item);
});
document.body.appendChild(container);
})();
</script>
Step 5 — Publish Your Changes
After creating all triggers, variables, and tags, you must publish the GTM container for the changes to go live in your store.
- In GTM, click Submit in the top right corner.
- Add a short description of the changes (e.g. "Trusted Shops integration").
- Click Publish.
Until you publish, none of the tags will be active in your live store. You can use GTM's Preview mode before publishing to verify everything is working correctly.
URL Reference: Checkout Page Paths by Store Language
The trigger conditions in Step 2 use URL path segments that depend on the language your Shoptet store is set to. Use the correct values from the table below when configuring your triggers. -
| Trigger | German (DE) | Czech (CS) |
|---|---|---|
| Thank you page (Triggers 1 & 2) | bestellung/danke | objednavka/dekujeme |
| Checkout step 2 (Trigger 3) | bestellung/schritt-2 | objednavka/krok-2 |
If your store runs in a language not listed here, please use the URL segments of that language (you can get them by making a test order for example) or contact our support team.
Updated about 10 hours ago
