Code Monkey home page Code Monkey logo

Comments (4)

sergey-karlo avatar sergey-karlo commented on July 20, 2024 1

Yes, you are right! It's code from analytics. My fault.

Thanks for help

from angular-google-tag-manager.

mzuccaroli avatar mzuccaroli commented on July 20, 2024

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.

sergey-karlo avatar sergey-karlo commented on July 20, 2024

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.

mzuccaroli avatar mzuccaroli commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.