Comments (4)
Yes, you are right! It's code from analytics. My fault.
Thanks for help
from angular-google-tag-manager.
according to the official documentation https://developers.google.com/tag-manager/quickstart
the include script is
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
so the url "...gtm.js?id=" works fine in many projects sincerly I don't konw the "...gtag/js?id=" urls and how they work
is it possible that you have some problems in providing your GTM id in your module?
from angular-google-tag-manager.
I've checked it several times. ID is correct.
And as I mentioned, this one works https://www.googletagmanager.com/gtag/js?id=<MY_ID>
So ID is correct for sure.
The URL I'd provided is generated by GTM from site settings page. The complete code from GTM is:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<MY_ID>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<MY_ID>');
</script>
from angular-google-tag-manager.
OK the problem here is that the code you have pasted is for google analytics not for google tag manager
so I presume that your ID is an analytics id, something like UA-112233456-1
the GTM id is something like: GTM-W3T4XYZ
these are two different services but you can include analytics code via GTM integration, take a look to this article: https://itnext.io/how-to-add-google-tag-manager-to-an-angular-application-fc68624386e2
and the official google guide on how to integrate analytics on GTM: https://support.google.com/tagmanager/answer/6107124?hl=en
from angular-google-tag-manager.
Related Issues (20)
- Null-Like GTM-ID should not throw an error HOT 3
- document is not defined on SSR
- Weird appendage
- Angular 15 support HOT 1
- The library does not add GTM script to the DOM HOT 3
- Push values into the data layer HOT 1
- Unable to import angular-google-tag-manager-config.service HOT 7
- Unable to resolve dependency tree - v1.6.1 tries to check v1.7.0 HOT 1
- Clear the dataLayer HOT 1
- gtm_resource_path appends to url
- Add tag at the beginning of dataLayer
- Console exception when loading GTM using the library HOT 1
- Angular 16 support HOT 7
- Youtube video keep emitting gtm.video after navigating away HOT 3
- Unable to resolve dependency tree. v1.7.0 tries to check v1.8.0
- Angular 17 Support HOT 11
- Feature request: Add removeGtmFromDom function to GoogleTagManagerService
- getDataLayer won't work because it expects a type `arguments` not `array`
- Support for @angular/common@"^17...
- Is an angular 18 version on the way ? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-google-tag-manager.