Purchase tracking with Google Tag Manager
With the setting Google Tag Manager: send the purchase event on the offer page, the offer page adds the purchase to the dataLayer as soon as it opens, once per order in each browser tab. Your purchase tags in Google Tag Manager then record the purchase even when the customer does not continue from the offer page to the order confirmation page.
The URL of the order confirmation page shows whether the customer came from the offer page. A condition in Google Tag Manager uses this to keep your purchase tags from counting the order a second time. An accepted offer is reported as a separate event.
The setting is off by default. It works with Google Tag Manager and the standard dataLayer; see Limits.
What the extension sends
The purchase, on the offer page
When the offer page opens, the extension adds a GA4 purchase event with the order as the customer placed it, before they decide on the offer:
| Field | Content |
|---|---|
transaction_id | The order number. |
value | The order total: goods plus shipping, minus vouchers, including tax, also for customer groups that see net prices. Shopware's own Google Analytics integration sends the same figure. |
tax, shipping, currency | The tax, the shipping costs and the currency of the order. |
coupon | The promotion codes used on the order, separated by commas. Only when the order has a promotion code. |
items | Each product with item_id (product number), item_name, item_variant (the options of the variant, e.g. size and colour), item_brand (the manufacturer, when the product has one), quantity and price (the unit price as stored on the order, i.e. net for customer groups that see net prices). |
The event is added once per order in each browser tab. Reloading the offer page does not add it again, and the preview in the Administration never adds it.
The purchase never includes the item added through the offer. Most customers decline the offer, and the purchase is added before they decide. An accepted offer is reported as a separate event.
The accepted offer, on the order confirmation page
When the customer accepts the offer, the order confirmation page adds a separate event cwk_ppu_upsell_accepted with the offer product only:
| Field | Content |
|---|---|
transaction_id | The same order number. |
value | The amount added to the order for the offer product: gross, or net for customer groups that see net prices. It is the same amount the extension records in its analytics. |
currency | The currency of the order. |
items | The offer product, with the same fields as in the purchase. |
The event is added once per accepted offer in each browser tab; reloading the page does not add it again. On the order confirmation page, the extension adds no second purchase event. After a declined offer, the extension adds no event on the order confirmation page.
The cwkPpu parameter
When the customer goes from the offer page to the order confirmation page, the URL of the order confirmation page contains the parameter cwkPpu with one of three values:
| Value | When |
|---|---|
accepted | The offer product is on the order. |
declined | The customer declined the offer or cancelled the PayPal payment approval. |
shown | Any other return after the offer was shown: the customer clicked the link "View order confirmation page" on the offer page, the attempt to accept the offer failed, or the customer reopened an offer link that had expired or had already been used. |
When no offer was shown, for example because the offer link expired before the offer page opened, the URL has no cwkPpu parameter and your usual purchase tags fire as before.
The parameter is added in every shop, even when the setting is off. Other parameters in the URL of the order confirmation page are kept. If the query string of the URL (everything after the question mark) is longer than 8 KiB (8,192 bytes), the extension shows no offer for that order, and the order confirmation page opens as usual.
Set-up
- Open Extensions → My extensions, find Post-Purchase Upsell & Cross-Sell, open its … menu and select Configure. At the top, select All sales channels or the required sales channel. In the Emails, retention & advanced card, switch on Google Tag Manager: send the purchase event on the offer page.
- Check that every tag that records the purchase fires on the
purchaseevent (a trigger of the type Custom Event). A tag whose trigger reacts to the URL of the order confirmation page does not receive the purchase from the offer page; assign it such a trigger for thepurchaseevent instead. - In Google Tag Manager, add the condition Page URL does not contain cwkPpu to the triggers of every tag that records the purchase, for example GA4, Google Ads, Meta, Microsoft Advertising or Pinterest. Without this condition, these tags count the order a second time when the customer reaches the order confirmation page from the offer page.
- Optional: to record the revenue from accepted offers, create a trigger of the type Custom Event with the event name
cwk_ppu_upsell_accepted. Attach it to the tags that should receive this revenue, for example a GA4 event tag with the event namecwk_ppu_upsell_acceptedand the parameterstransaction_id,value,currencyanditems, read from the Data Layer Variablesecommerce.transaction_id,ecommerce.value,ecommerce.currencyandecommerce.items. Without a tag for this event, revenue from accepted offers is not sent to your analytics or advertising platforms. - Test the set-up in the Preview mode of Google Tag Manager. Place an order: the event
purchaseappears on the offer page. Decline the offer: the order confirmation page opens withcwkPpu=declined, and no purchase tag fires. Place a second order and accept the offer: the eventcwk_ppu_upsell_acceptedappears on the order confirmation page.
Switching on and off
Switch the setting on and publish the condition in Google Tag Manager at the same time, ideally at a time of day with few orders.
Offers that are open at that moment are affected:
- An offer page opened before the setting was switched on has not added a purchase event. If the customer reaches the order confirmation page after the condition is published, the order is not counted.
- An offer page opened after the setting was switched on adds the purchase event. If the customer reaches the order confirmation page before the condition is published, the order is counted a second time there.
When you switch the setting off, the extension adds neither event, but the cwkPpu parameter stays in the URL. Remove the condition from the triggers of your purchase tags at the same time; otherwise orders are not counted when the customer reaches the order confirmation page from the offer page.
Limits
- Google Tag Manager with the standard dataLayer. Both events are added to
window.dataLayer. A Google Tag Manager container set up with a renamed dataLayer receives neither event. - Content Security Policy. The events are added by a small inline script that carries Shopware's nonce. A policy that blocks inline scripts and does not allow scripts with this nonce stops both events.
- Other tracking. Shopware's built-in Google Analytics integration and tracking scripts outside Google Tag Manager receive neither event.
- Consent. The extension only writes to the dataLayer. Your Google Tag Manager container and your consent tool decide which tags fire. The extension itself sends nothing to Google or any other service.
- Per browser tab. The extension remembers for each browser tab whether it has added the purchase event. Opening the same offer link in a new tab or another browser adds the purchase again. GA4 ignores the repeat because the order number is the same; other platforms can count it. Opening the order confirmation page with
cwkPpu=acceptedin a new tab or another browser also addscwk_ppu_upsell_acceptedagain. GA4 does not deduplicate this custom event by order number. - Interrupted page. If the offer page does not finish loading after the shop has registered it as shown, the purchase event may be missing. If the customer later returns to the order confirmation page, its URL still contains
cwkPpu=shown, and your purchase tags then do not count this order.