Running Convert A/B Tests on Your Shoptet Store
Add two JavaScript snippets in the Shoptet admin, no app or API needed, and measure revenue per variation in about 30 minutes
| Author: | Dionysia Kontotasiou |
IN THIS ARTICLE YOU WILL:
- Get an Overview
- Install Convert Tracking Code
- Create Revenue Goal in Convert
- Add Revenue Snippet to Thank-you Page
- Verify Setup
- Target Pages and Track More Goals
- Understand Cookie Consent and GDPR
- Use Shoptet API
- Troubleshoot
Overview
Convert works on any Shoptet store by adding two pieces of JavaScript in the Shoptet admin: the Convert tracking code on every page, and a revenue snippet on the order confirmation page. There is no app to install and no developer API access is required. Setup takes about 30 minutes, plus one test order.
How it works:
Convert runs experiments in the visitor's browser. Its script loads on each storefront page, assigns visitors to variations, and applies your changes. On the thank-you page, a short snippet reads the order total from Shoptet's built-in dataLayer and sends it to Convert, so you can compare conversion rate, revenue per visitor and average order value per variation.
What you need:
- Admin access to your Shoptet store (rights to edit Templates → HTML code)
- Access to your Convert project
- About 30 minutes, and the ability to place a test order
What you don't need:
Shoptet Premium, a Shoptet addon, or API tokens. The Shoptet REST API is only relevant for the optional steps in the API section below.
Step 1: Install the Convert tracking code
The Convert script goes in Shoptet's Header HTML-code area, which inserts it before the closing </head> tag on every page.
- In Convert, open your project and go to Configuration → Environments and Tracking Code. Copy the tracking code.
- In the Shoptet admin, go to Templates → Editor of the appearance → HTML code (Czech admin: Vzhled a obsah → Editor → HTML kód).
- Paste the Convert code into the Header area. Put it at the very top of that area, above other scripts such as chat widgets or pixels.
- Save.
Why at the top: Convert changes the page before it is shown. Loading it early prevents flicker, where visitors briefly see the original before the variation.
If your checkout or payment confirmation runs on another domain, add the same tracking code there too, and add that domain to the Convert project.
Step 2: Create a revenue goal in Convert
- In your Convert project, add a new goal from the goal templates and choose Revenue.
- Select Manual Revenue Tracking.
- Save, then note the goal ID shown in the generated code. You will paste it into the snippet in Step 3.
- Attach this goal to each experience you want to measure by revenue.
With this goal active, Convert reports revenue per visitor (RPV) and average order value (AOV) for each variation.
Step 3: Add the revenue snippet to the thank-you page
Shoptet publishes order data in a JavaScript object called the dataLayer. On the page shown after a successful order, its page type is thankYou. The snippet below runs only on that page, reads the order, and sends it to Convert.
Paste it into the Footer HTML-code area (same screen as Step 1), and replace YOUR_GOAL_ID with the goal ID from Step 2.
<!-- Convert revenue tracking for Shoptet -->
<script>
(function () {
var s = window.dataLayer && dataLayer[0] && dataLayer[0].shoptet;
if (!s || s.pageType !== 'thankYou' || !s.order) return;
// Revenue: confirm the field name in your store (see Step 4)
var revenue = Number(s.order.total);
// Item count: sum quantities if available, otherwise count lines
var items = s.order.content || [];
var count = 0;
for (var i = 0; i
< items.length; i++) {
count += Number(items[i].quantity) || 1;
}
if (!revenue) return;
window._conv_q = window._conv_q || [];
window._conv_q.push(["pushRevenue", revenue.toFixed(2), count, "YOUR_GOAL_ID"]);
})();
</script>
Rules for the values:
- Revenue uses a dot as the decimal separator, for example 1249.50.
- Which total to send: Shoptet's total includes VAT and shipping; netto is items only, without VAT. Pick one and use it consistently across all tests. Most stores use total.
- Currency: the snippet sends the amount as-is. If you sell in several currencies, convert to one base currency before sending, or target each test at one currency, so results stay comparable.
- Repeat purchases: to count more than one order per visitor, add "force_multiple" as a fifth value in the pushRevenue call.
Step 4: Verify the setup
Do one test order before launching any experiment. It confirms the script loads and the revenue values are correct for your template.
- Check the tracking code. Open any store page, open the browser console (F12), and type window._conv_q. If it returns an object rather than undefined, Convert is loaded.
- Check the order fields. Place a test order. On the thank-you page, run getShoptetDataLayer('order') in the console. Confirm the field holding the order total (expected total) and the item list (expected content, with a quantity per line). If your names differ, update the snippet.
- Check revenue reached Convert. Run a test experience in QA mode or targeted to your own IP. After the test order, confirm the revenue goal shows a conversion with the right amount in the experience report.
- Cancel the test order in Shoptet so it does not affect your sales figures.
Once all four checks pass, you can launch experiments.
Targeting pages and tracking more goals
Shoptet URLs vary by language and SEO settings, so page type is a more reliable way to target experiences than URL patterns. Read it with dataLayer[0].shoptet.pageType.
|
Page type |
Page |
|
homepage |
Home page |
|
category |
Category listing |
|
productDetail |
Product page |
|
article |
Blog or content article |
|
section |
Other content section |
|
cart |
Cart |
|
billingAndShipping |
Checkout: shipping and payment |
|
customerDetails |
Checkout: customer details |
|
thankYou |
Order confirmation |
Targeting an experience to, for example, product pages: in the experience's location or audience, use a JavaScript condition such as:
dataLayer[0].shoptet.pageType === 'productDetail'
Funnel goals: simple page-visit goals for cart and checkout steps can use the same page types. For actions without a page load, such as adding to cart, listen for Shoptet's ShoptetDataLayerUpdated event and trigger a Convert goal:
<script>
document.addEventListener('ShoptetDataLayerUpdated', function () {
window._conv_q = window._conv_q || [];
window._conv_q.push(["triggerConversion", "YOUR_ADD_TO_CART_GOAL_ID"]);
});
</script>
This event fires on several changes, not only cart additions. If you need precision, compare the cart contents before and after inside the listener.
Cookie consent and GDPR
Convert stores visitor assignments in cookies, so in the EU it typically needs consent under your cookie policy. Decide this with whoever owns privacy for your store before launch.
- Match your consent setup. If you use Shoptet's cookie bar or a third-party consent tool, make sure Convert only runs or stores data in line with the choice the visitor made.
- Check Convert's privacy settings. Your Convert project has GDPR and data-privacy options; set them to match your consent approach.
- Expect a smaller sample. Visitors who decline cookies will not be in tests. That is normal, but it lengthens the time needed to reach significance.
- Treat both arms the same. Consent rules must apply equally to original and variations, otherwise results are biased.
This guide is not legal advice; confirm requirements with your data-protection adviser.
Optional: using the Shoptet API
The steps above are all a single store needs. The Shoptet REST API helps in two advanced cases.
|
Use case |
How |
Access needed |
|
Check Convert revenue against real orders |
Register webhooks for order:create, order:paid and order:cancel, then compare paid, non-cancelled orders with what Convert recorded during a test |
Private API token (Shoptet Premium) or an addon |
|
Deploy Convert to many Shoptet stores (agencies, partners) |
Build a Shoptet addon that inserts the Convert code per store through the /template-include endpoint, instead of pasting it by hand |
Shoptet partner account and addon (OAuth) |
Reconciliation is worth doing when your store has many unpaid or cancelled orders, such as bank-transfer or cash-on-delivery orders. The thank-you page fires at order placement, not at payment.
Troubleshooting
|
Symptom |
Likely cause |
Fix |
|
window._conv_q is undefined |
Tracking code not saved, or pasted in the wrong area |
Re-check the Header HTML-code area and save; clear any cache |
|
Original page flashes before the variation |
Convert loads too late |
Move the Convert code to the very top of the Header area |
|
No revenue recorded |
Wrong goal ID, or snippet in the wrong area |
Confirm the goal ID; snippet must be in the Footer area, after the tracking code |
|
Revenue is 0 or wrong |
Field names differ in your template |
Run getShoptetDataLayer('order') on the thank-you page and update the snippet |
|
Revenue includes VAT or shipping when you didn't want it |
Snippet sends total |
Switch to netto, and keep it consistent across tests |
|
Revenue lower than Shoptet reports |
Visitors who declined cookies aren't tracked |
Expected; compare against tracked visitors only |
|
Revenue higher than paid orders |
Unpaid or cancelled orders still counted |
See reconciliation in the API section |
Does this slow down the store?
Convert adds one script. Loading it in the header is standard for client-side testing and avoids flicker.
Can I test checkout pages?
Yes. Checkout steps run on your store domain, so the tracking code is already there. Use the page types above to target them.
Do I need a developer?
No for Steps 1–4. Yes for the optional API work.