Questions tagged [react-gtm-module]
25 questions
6
votes
2 answers
Next.js + react-gtm-module ReferenceError: document is not defined
I use this piece to initialize GTM in my Next.js app:
const tagManagerArgs = {
gtmId: "GTM-XXXXXX"
};
TagManager.initialize(tagManagerArgs);
But when I am trying to start an app with it I am getting the error:
ReferenceError: document is not…

flppv
- 4,111
- 5
- 35
- 54
3
votes
1 answer
Cookie “_ga” will be soon rejected because it has the “SameSite” attribute set to “None”
I have added Google Tag manager to my react project, with the help of react-gtm-module
After successfully adding it, I see some warning in consoles which are below like -
Cookie “_ga” will be soon rejected because it has the “SameSite”
attribute…

Ratnabh kumar rai
- 1,426
- 4
- 21
- 48
3
votes
2 answers
Is is possible to trigger 'Container Loaded' twice or force GTM to reload ? (React)
I am actually working on a large web application, which was initially built with Symfony/Twig, and that is gradually refactored using React. But since I am using React, some of my pages get no "views" in Google Tag Manager (GTM).
I followed this…

Dony
- 1,543
- 2
- 10
- 25
2
votes
3 answers
GTM firing same event multiple times
I have a NextJS app that uses GTM to pass event to GA4.
I load GTM using the package react-gtm-module and initialize it as follows:
TagManager.initialize({
gtmId: process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER,
dataLayer: {
…

good1492
- 161
- 1
- 10
2
votes
1 answer
react-gtm-module not posting the event params
I'm using Google Tag Manager to handle a Facebook Pixel.
That pixel should get fired through a Custom Event with custom params: { make, model } and custom conditions: { make equals ford, model equals focus }.
I have two basic implementations (each…

Viewsonic
- 827
- 2
- 15
- 34
1
vote
0 answers
How to send GTM event after sign in with Auth0 hooks?
We have a react app with react-Auth0 for authentification using the hook loginWithRedirect.
const { user, isAuthenticated, loginWithRedirect, logout } = useAuth0();
We want to send a custom GTM (Google Tag Manager) event with Sign-in method and…

Norbert Feron
- 46
- 1
- 5
1
vote
1 answer
How to avoid TagManager.initialize() running many times?
I use react-gtm-module (version 2.0.11) to create Google Tag Manager for my ReactJs app.
My problem is that each time a component renders, the function TagManager.initialize runs again. This creates duplicate GTM scripts (as attached).
I have to get…

vanminhquangtri
- 145
- 1
- 9
1
vote
1 answer
Is it possible to disable Google Tag Manager in a SPA after a user logs in?
I have a React app and want to install Google Tag Manager on certain pages, but I do not want it present after a user logs in. Is it possible to disable / remove the GTM scripts after a certain user action?
I am using react-gtm-module to install…

Danielle McCarthy
- 31
- 1
1
vote
0 answers
Fire Tag in Google Tag Manager on url change of React Application
I have added Google Tag Manager to my React Application with the help of this module - react-gtm-module
So i initialized my GTM on base file as the doc says
const tagManagerArgs = {
gtmId: process.env.REACT_APP_GTM_KEY,
};
…

Ratnabh kumar rai
- 1,426
- 4
- 21
- 48
1
vote
1 answer
GA4 Google Analytics event doesn't appear as conversion
I'm using Google Tag Manager(react-gtm-module) package) to push custom events to Google Analytics. In code i do it like this:
GTM.dataLayer({ dataLayer: { event: 'Custom event' } });
Then, in GTM i have trigger for this Custom event (event name is…

Kitty Captain
- 43
- 1
- 5
1
vote
2 answers
Google Tag Manager - Send dataLayer from Backend
I had GTM set up on my website and I can send dataLayer to my GTM containers just fine. I wonder if I can do the same from my backend? My backend runs on spring boot and I am having difficulty finding any documentation. My use case is that I want to…

user1955934
- 3,185
- 5
- 42
- 68
1
vote
1 answer
React - Why document title does not update for Google Analytics?
I initialized google tag manager by using the below code.
import TagManager from 'react-gtm-module';
const tagManagerArgs = {
gtmId: 'GTM-TLDWCL3'
}
TagManager.initialize(tagManagerArgs);
I set the page title at every page component by using…

Htet Khant
- 13
- 4
1
vote
1 answer
react-gtm-module appears to create an invalid src path?
It appears that react-gtm-module is creating the wrong src path. It is swapping a "/" with a ".".
This is the src path as provided by Google.
https://www.googletagmanager.com/gtag/js?
Whereas the src path below is generated by react-gtm-module
gtag:…

Bruce
- 119
- 2
- 10
0
votes
0 answers
GTM vip creation with ansible and error is msg: 01070226: pool members test_auto_https references a nonexistence virtaul server
I am facing an error while automating GTM vip creation with ansible and error is msg: 01070226: pool members test_auto_https references a nonexistence virtaul server.
@error at adding members to existing GTM pool
name: adding existing vip to gtm…

Sreekanth
- 1
- 1
0
votes
0 answers
Keep sending multiple requests when use react-gtm-module library in sepecic route in Next.js
As title, i use react-gtm-module library in Next.js.
And there is a route as http://localhost:3000/dynamic/%5Bid%5D
And this route imports the component like below:
import { useEffect } from 'react';
import TagManager from…

Yucheng
- 18
- 3