Skip to main content
Shopware 6 has no built-in field for custom head code. You add pagent with a plugin from the Shopware Store, or with a small change to your theme. Copy your pagent snippet. You find it in the install step after you start your trial, and any time later in pagent under Settings → Setup. It looks like this, with your own client key:
Paste it unchanged. Don’t add async, defer or type="module": pagent needs to load before your page shows, so visitors never see the original flash.

Option 1: a head-code plugin

This works without a developer.
1

Find a head-code plugin

In the Shopware Store, search for a plugin that adds custom scripts or HTML to the <head>, for example with the words “custom scripts”, “HTML head” or “tracking code”.
2

Install it

In your Shopware admin, go to Extensions → My extensions, then install and activate the plugin.
3

Paste the snippet

Open the plugin’s configuration and paste your snippet into its head field. If it asks where to place the code, choose the head, as early as possible.
4

Save and clear the cache

Save, then clear the shop cache under Settings → System → Caches & indexes.
These plugins come from other providers, not from Shopware or pagent. Choose one that is compatible with your Shopware version.

Option 2: your theme (for developers)

In your own theme or plugin, extend the storefront’s meta.html.twig and add the snippet to the layout_head_meta_tags block, at the top of <head>:
Then clear the cache, for example with bin/console cache:clear.
pagent runs on your storefront pages. Your checkout pages are part of the storefront in Shopware too, so the snippet loads there as well.

Check it worked

  1. Open your site in a private browser window, so no cached version shows.
  2. Back in pagent, click Check connection in the install step. If you’ve finished setup already, open Settings → Setup: it shows You are ready once pagent has received visits from your site.
  3. pagent loads your live site and looks for the snippet. When it finds it, you can start your first test.
pagent couldn’t find the snippet? Make sure you published or saved the change on your live site, then check again. If you installed it through Google Tag Manager, open your site once in a normal browser window first.