Search code examples
javascriptangulartypescriptgoogle-chromegoogle-tag-manager

Install Google Tag Manager (gtm) to Angular app


I tried to install GTM to an Angular app by adding the script to the head and the iframe to the body in the index.html file.

I load the app in Chrome an I can see that are added in the html.

The Google Tag Assistant plugin from Chrome detects it well but when I go to the Network tab I can't see any gtm.js request and also I type in the console google_tag_manager and I get google_tag_manager is not defined.

I tried the plugin angular-google-tag-manager but happens the same.

I don't know what's going on, any guess?


Solution

  • I found what was going on.

    I had an script for the cookies of my app and I guess is using gtm or analytics and commenting that script solved the problem. I also tried changing the order of the scripts and also solved the problem, first my gtm script and after the cookies script which was causing the problem.