For the complete documentation index, see llms.txt. This page is also available as Markdown.

Shopware

Setting up server-side tagging for a Shopware webshop

Setting up server-side tagging for Shopware

This article walks you through the full setup of server-side tagging on a Shopware store.

Before you start

This article picks up where Getting Started leaves off. Make sure all of the steps in the Setup AdPage container article have been followed. Which means that:


Step 1: Set up an e-commerce dataLayer

AdPage does not offer a native dataLayer plugin for Shopware, so you will need to set one up yourself. Your shop may already have a dataLayer in place. If it does not, we recommend the following plugin: Shopware plugin settings for GA4 + remarketing

Within this plugin, disable everything except enhanced ecommerce and hash enhanced conversion. The plugin can send data to GA4 and Google Ads directly, but that won't be through server-side tagging. Leaving those options enabled would result in duplicate hits. The only thing this plugin needs to do is push e-commerce events to the dataLayer, where your server-side tagging setup will picks them up.

Once installed, open your shop in the browser and confirm that the dataLayer is populated. You should see events such as view_item, add_to_cart and purchase appear as you move through the shop and complete a test order.

The settings in the plugin:


Step 2: Set up the AdPage webhook plugin

Set up the webhooks for the purchase event. You do this by installing the AdPage webhook plugin via Composer. The plugin is available here.

The webhook sends the order data from Shopware to your AdPage server container directly from the backend, independent of the browser. This makes the purchase event reliable even when a visitor closes the tab immediately after checkout, when the browser blocks tracking, or when consent has not been granted for client side tracking.

If you are not able to install the plugin via Composer yourself, ask your web developer or hosting party to do it for you.


Step 3: Set up your Sales Channel

Shopware works with a separate configuration for every sales channel. A sales channel can be its own domain, but it can also live within an existing domain. Because plugin settings are applied per sales channel, you configure the AdPage plugin separately for each one.

An example. The "domainx" sales channel covers domainx.nl. Alongside it there is a second sales channel, "domainx business", that sits within the same domain and will become available at https://www.domainx.nl/business or https://www.domainx.nl/workwear. Both need their own configuration.

  • Select the sales channels whose transactions you want to forward to your online marketing platforms. The tagging URL can be set per channel.

  • If you add or change sales channels later on, you can adjust them in the plugin as well. Make sure the tagging URL you enter for the domain matches the tagging URL configured in your tagging platform.

That last point is the one that most often goes wrong in practice, so if you want I can expand it into a short callout explaining what breaks when the two do not match (webhooks arriving on a container that does not recognise the domain, so purchases never land in the platforms).


Step 4: Set up GA4 tracking in Google Tag Manager

Server-side tagging with an AdPage server container works by receiving GA4 formatted requests from the client. Therefore you have to set up GA4 event tags on the client that send these requests towards your server container URL. And on your server container you'll need a GA4 Client and a GA4 tag in the server container make sure those requests get forwarded to your Google Analytics 4 property as GA4 events.

Google Tag Manager server container steps

  1. GA4 Client. A Client receives incoming data on the server. The GA4 Client lets the server read data in GA4 format. It already exists by default under Clients, and needs no changes for a regular setup.

  2. GA4 tag. Go to Tags and create a new tag with Google Analytics: GA4 as the configuration. Two fields matter most. Measurement ID decides which property the data goes to, and leaving it empty means the tag uses whichever Measurement ID your web container sends along. Event name forces one specific event name, so leave it empty to pass incoming event names through unchanged.

  3. Trigger. Set the trigger condition to Client Name equals GA4 so all incoming GA4 events are forwarded. If Client Name is not in the dropdown, add it via Choose Built-in variable.

  4. Preview URL. Go to Admin, open Container settings and add your tracking subdomain under Server container URLs. Without this, server side preview mode will not launch.

Google Tag Manager web container steps

  1. Override the GA4 endpoint in the Google tag. The Google tag loads the measurement library and holds the shared configuration for all your GA4 hits. Event tags carry only the event name and parameters, and inherit the rest from the Google tag with the same Measurement ID. Setting the endpoint here once means every event tag follows. Add these three parameters:

    • server_container_url = your AdPage server container URL

    • send_page_view = false

    • first_party_collection = true

  2. GA4 page_view event tag. With send_page_view set to false, the page_view event is no longer created automatically, which is what you want. An automatic page_view cannot carry extra parameters, and event_id in particular is needed for deduplication on the marketing platforms. Create a new Google Analytics: GA4 Event tag, fill in your Measurement ID and set the event name to page_view. For the trigger, use the dataLayer event your Consent Management Platform pushes on every page, or All Pages if there is none.

Test before publishing

Every existing GA4 event tag with the same Measurement ID now routes through your server container as well, including purchases, form submissions and custom events. Open preview mode in both containers side by side, click through your key interactions, and confirm each request reaches your tracking domain, gets claimed by the GA4 Client and leaves for GA4 with the expected parameters. Only publish once you have seen every important event complete that path.


Need help?

Still seeing missing events, duplicated conversions or unassigned traffic after following these steps? Reach out to our support team and we will take a look with you.

Last updated

Was this helpful?