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 'react-gtm-module';
useEffect(() => {
TagManager.initialize({ gtmId: 'GTM-xxxxxx' });
});
const Dynamic = () => {
...
}
export default Dynamic;
It turns out that TagManager indeed send request to googletagmanager.com
and other requests including m.vpadn.com
etc. But it keeps sending multiple requests like https://www.google-analytics.com
and others as picture.
It will make this route of website loading continuously. But there are problems in other routes like http://localhost:3000/blog/%5Bid%5D, it only shows problem in http://localhost:3000/dynamic/%5Bid%5D.
I have tried add script manually to send request. It does not work. I have tried to change name as http://localhost:3000/dynamic-test/%5Bid%5D, It works, it will not keep sending multiple requests. But it is difficult to change the route name.
My expecting is to send once gtm request and not change the route name.