Integrate Google Tag Manager
The Google Tag Manager integration loads your Google Tag Manager (GTM) container on every published project on the Maglr domain you connect it to. Maglr then sends events and variables to the page's data layer, which you can use in GTM to send data to Google Analytics 4 or other tools. For more about GTM itself, see Google's Tag Manager help.
Creating a Google Tag Manager account and container
To use Google Tag Manager with Maglr, you need a GTM account with a web container. The container ID (it starts with GTM-) is what you connect to your Maglr domain.
To create an account and container in Google Tag Manager:
- Go to https://tagmanager.google.com/ and sign in with your Google account.
- Click
Create Account. - Under Account Setup, enter an account name and choose your country.
- Under Container Setup, enter a container name, for example your domain, and choose
Webas the target platform. - Click
Createand accept the terms of service.

After you create the container, copy its container ID (it starts with GTM-). The container ID is shown at the top of your GTM workspace. You paste it into your Maglr domain settings.

Connecting Google Tag Manager to a Maglr domain
You connect a Google Tag Manager container to a Maglr domain with its container ID (for example GTM-XXXXXXX). Paste only the container ID, not the full installation snippet that GTM also offers: Maglr adds the GTM script to your published projects itself.
To connect Google Tag Manager to a domain:
- Go to
Settings→Domain names. - Click the domain you want to add tracking to.
- Scroll to
Statistics & integrationand turn onGoogle Analytics or GTM. - Set
Integration typetoGoogle Tag Manager. - Paste your container ID (for example
GTM-XXXXXXX) intoGTM code. - Click
Save changes.
All published projects on that domain now load your GTM container. A domain uses either Google Analytics or Google Tag Manager, not both. For the other settings in this section, see Statistics & integration settings for your domain.
Reading Maglr data with Data Layer Variables
Maglr pushes its data, such as the event category, action and label or the page title, to the data layer as keys like maglrCategory. To use a key in Google Tag Manager, create a Data Layer Variable for it. The Data Layer Variable Name must match the Maglr key exactly, including capitals. For all keys, see Maglr data layer variables.
To create a Data Layer Variable for a Maglr key, in Google Tag Manager:
- Go to
Variablesand clickNewunder User-Defined Variables. - Choose
Data Layer Variableas the variable type. - Enter the Maglr key, for example
maglrCategory, as theData Layer Variable Name. - Name the variable and click
Save. Giving it the same name as the key, for examplemaglrCategory, makes it easiest to recognise in tags.
Repeat these steps for each Maglr key you want to use. Tags refer to a variable by its own name in double curly brackets, for example {{maglrCategory}}.

Creating triggers for Maglr events
Every Maglr event, such as maglrUserEvent or maglrVirtualPageView, is a data layer event. In Google Tag Manager you catch it with a Custom Event trigger whose Event name matches the Maglr event name exactly, including capitals. For all event names, see Maglr data layer events.
To create a trigger for a Maglr event, in Google Tag Manager:
- Go to
Triggersand clickNew. - Choose
Custom Eventas the trigger type. - Enter the Maglr event name, for example
maglrUserEvent, as theEvent name. - Optional: to fire only for some events, choose
Some Custom Eventsand add a condition, for examplemaglrCategoryequalsVideo. - Name the trigger and click
Save.

Sending Maglr events to Google Analytics 4
To send Maglr events to Google Analytics 4, create a Google Analytics 4 event tag in Google Tag Manager that fires on your Maglr trigger. This uses the Data Layer Variables and triggers described in the sections above.
To create a GA4 event tag for Maglr events, in Google Tag Manager:
- Go to
Tagsand clickNew. - Choose
Google Analytics: GA4 Eventas the tag type. - Enter your GA4 Measurement ID.
- Set the
Event Name, for example{{maglrCategory}}. - Add event parameters, for example
maglr_actionwith the value{{maglrAction}}andmaglr_labelwith the value{{maglrLabel}}. - Under
Triggering, choose your Maglr trigger. - Click
Save.
maglr-{{maglrCategory}}.
Testing and publishing your Google Tag Manager container
Test your Google Tag Manager setup on a published project, using GTM's preview mode. Maglr doesn't load your GTM container in its own previews of a project, so Maglr events don't show up there.
To test and publish your container:
- In Google Tag Manager, click
Preview. - Enter the published URL of a project on the domain you connected.
- Interact with the project, for example open pages or click links, and check that the Maglr events appear in the preview panel.
- When everything works, click
Submitin Google Tag Manager to publish your container.
Cookie consent and Google Tag Manager
Maglr's own cookie consent doesn't stop your Google Tag Manager container from loading. When you turn on Activate cookie consent notification for a domain, the visitor's choice affects Maglr's own features, such as its statistics, its Google Analytics integration and YouTube and Vimeo videos, but not your GTM container. Tags in your GTM container fire whatever the visitor chooses, unless you limit them in GTM yourself.
MaglrCookieConsented equals true.Maglr sends two data layer events for cookie consent:
maglrConsentChanged: sent when the visitor's choice is known, either on page load from a stored choice or when the visitor accepts or rejects. It carries the keymaglrCookieConsented, which istruewhen the visitor accepted andfalsewhen they rejected.maglrConsentRequested: sent only inManual mode, when Maglr asks your own consent tool to show the consent request again.
To fire a tag only after consent, use a Custom Event trigger with Event name maglrConsentChanged and the condition maglrCookieConsented equals true. For how cookie consent works in Maglr, see Configure cookie consent.
Maglr data layer events
Maglr pushes these events to the data layer of a published project. In Google Tag Manager, catch each one with a Custom Event trigger whose Event name matches the name exactly.
Event | When Maglr sends it |
|---|---|
| When the first page of a project loads. |
| Each time the visitor goes to another page after the first. |
| Once per page, when the page has finished preloading in the background. |
| When the visitor interacts with the content, for example plays a video, opens a popup or clicks a link. |
| When the visitor uses the interface around the content, for example the overview page, navigation menu or side menu. Also sent once, 15 seconds after a project opens, if Maglr hasn't sent any other event in that time. |
| When the visitor's cookie consent choice is known or changes. |
| In |
Maglr data layer variables
Maglr adds these keys to the events it pushes to the data layer of a published project. To use a key in Google Tag Manager, create a Data Layer Variable whose Data Layer Variable Name matches the key exactly, including capitals. Page keys, such as maglrIssueID, maglrPageTitle and MaglrCookieConsented, are added to an event when Maglr knows the current project and page.
Key | What it contains | Example |
|---|---|---|
| The Maglr event name. |
|
| The event category, on user and interface events. |
|
| The event action, on user and interface events. |
|
| The event label, on user and interface events. |
|
| An event value, on some events. This is often the project ID. |
|
| The name of the element that sent the event, on user events that come from a specific element. |
|
| The ID of the element that sent the event, on user events that come from a specific element. | |
| The ID of the project. |
|
| The ID of the current page. |
|
| The language of the project. |
|
| The type of page. This is usually |
|
| The loading status of the page: |
|
| The page's Reference, only when one is set in the page settings. |
|
| The URL path of the page. |
|
| The full URL of the page. | |
| The title of the page. |
|
| The title of the project. |
|
| Whether the visitor accepted Maglr's cookie consent: |
|
| Only on the |
|
User event categories, actions and labels
Maglr sends a maglrUserEvent when a visitor interacts with the content of a published project. Each event has a category (maglrCategory), an action (maglrAction) and a label (maglrLabel). Values are case-sensitive in Google Tag Manager conditions.
In a published project, the label of a user event usually ends with the project and page ID, for example My popup :: (1234|5678). To match a label in a trigger condition, use contains or starts with instead of equals.
Category | Action | Label |
|---|---|---|
Video | Play |
|
Audio | Play, Stop or End | Element name |
Form | Submit | Form name |
Popup | Open | Popup name |
Popup | Close | Popup name |
Link | Toggle-layer | Names of the elements shown or hidden, separated by commas |
Link | Scene | Scene name |
Link | Internal | URL path of the target page |
Link | External | URL |
Link | File | File name |
Link | Reference | Reference name |
Link | Element-action | Element name and action (see below) |
Link | Scrollto |
|
Link | Interface | Interface link, for example |
Link | Social-link | Social network |
Link | Postmessage | Message |
Link | Multiple actions | Multiple actions |
Link | Accessibility | Close_layer_keyboard |
Slideshow |
| Element name |
Scroll-depth | Position-desktop or Position-mobile | How far the visitor got on the page, as a number from 0 to 100 (see below) |
Embeds | Embed element name | Value the embed sends |
More about specific user events:
- Video: events are sent only when a visitor starts a video manually. Autoplay videos don't send events.
- Element-action: the label is the element name and the action, separated by a vertical bar without spaces. Actions include
next,previous,restart,playandpause. - Scroll depth: the event is sent once, when the visitor leaves the page. Depending on the page, the depth is either rounded down to 0, 25, 50, 75 or 100 (anything past 90% counts as 100), or the percentage of the page's scenes the visitor has seen.
- Form: a form submission is sent with category
Formand actionSubmit. Depending on the page, it can arrive as amaglrUserEvent, as amaglrInterfaceEvent, or as both. Check in Google Tag Manager's preview mode which events your form sends, and use one event name in your trigger so each submission is counted once. - Element names are the names the elements have in the editor.
Interface event categories, actions and labels
Maglr sends a maglrInterfaceEvent when a visitor uses the interface around the content of a published project: the overview page, the viewer and the side menu. Each event has a category (maglrCategory), an action (maglrAction) and a label (maglrLabel). Values are case-sensitive in Google Tag Manager conditions.
Side-menu tab names, used as labels below, are spreads, sitemap, issues, info, contact, register, share, search, pdf and loggedin.
Category | Action | Label |
|---|---|---|
Interface-overview | Open-sidemenu | Side-menu tab name, for example |
Interface-overview | Open-category | Category name |
Interface-overview | Change-language | Language abbreviation, for example |
Interface-overview | Open-legacy-issue | Issue name |
Interface-overview | Logo-click |
|
Interface-overview | Accessibility |
|
Interface-viewer | Open-sidemenu | Side-menu tab name, or |
Interface-viewer | Open-overview |
|
Interface-viewer | Gate-activated | Form name |
Interface-viewer | Gate-form-submitted | Form name |
Interface-viewer | Gate-closed-manually | Form name |
Interface-viewer | Cookie-consent |
|
Interface-viewer | Accessibility |
|
Interface-viewer | Switch-audio |
|
Interface-sidemenu | Open-tab | Side-menu tab name |
Interface-sidemenu | Search-query | Search text the visitor submitted |
Interface-sidemenu | Open-search-link | Title and ID of the page the visitor clicked in the search results, for example |
Interface-sidemenu | Share-tab |
|
Interface-sidemenu | Download-tab |
|
Interface-sidemenu | Open-contact-link | URL of the contact link |
Interface-sidemenu | Contact-tab |
|
Interface-sidemenu | Register-tab |
|
Interface-sidemenu | Loggedin-tab |
|
User-still-there? | No-interaction |
|
The User-still-there? event is sent once, 15 seconds after a project opens, if Maglr hasn't sent any other event in that time. A page view also counts as an event, so you may rarely see it.
Frequently asked questions
Why don't I see Maglr events in Google Tag Manager when I preview my project in Maglr?
Maglr doesn't load your Google Tag Manager container in its own previews of a project. To test your setup, use the Preview button in Google Tag Manager and enter the published URL of a project on the domain you connected to GTM.
Does Maglr's cookie consent stop Google Tag Manager tags from firing?
No. Maglr's cookie consent doesn't stop your Google Tag Manager container from loading, and tags in the container fire whatever the visitor chooses. To fire a tag only after consent, use a Custom Event trigger on the maglrConsentChanged event with the condition maglrCookieConsented equals true.
Can I use Google Analytics and Google Tag Manager on the same domain?
Not as two separate integrations. In a domain's Statistics & integration settings, Integration type is either Google Analytics or Google Tag Manager. To use both, choose Google Tag Manager and add a Google Analytics 4 tag to your GTM container.
Do autoplay videos send events to Google Tag Manager?
No. Maglr sends a video event (category Video, action Play) only when a visitor starts a video manually. Videos that play automatically don't send events.
Why does the Maglr event label end with numbers in brackets?
In a published project, Maglr adds the project ID and page ID to the end of the label of a user event (maglrLabel), for example My popup :: (1234|5678). To match these labels in a Google Tag Manager trigger condition, use contains or starts with instead of equals.
Updated on: 15/10/2026