Skip to content

Universal Analytics Creates A Named Tracker by Default #116

@rcollette

Description

@rcollette

What I'm seeing at the moment is that a named tracker is created by default. I'm not doing anything to set a named tracker anywhere, I don't make any ga() call in my code. I'm merely including the tracking code.

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=MY-ACCOUNT-ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'MY-ACCOUNT-ID');
</script>

What I see when the app loads is

Running command: ga("create", "MY-ACCOUNT-ID", {cookieDomain: "auto", name: "gtag_my_account_id"})

Note that the tracker name created is gtag_my_account_id. This is done in line 4049 of the gtag code (after formatting in chrome).

f = "gtag_" + c.split("-").join("_")

I have to call

$analyticsProvider.settings.ga.additionalAccountNames = ['gtag_my_account_id'];

For any of the tracking events to show show up in google analytics.

The problem is that there are redundant calls being made to the default tracker as well, which simply go into thin air.

Running command: ga("send", {hitType: "pageview", page: "/home"})
   Command ignored. Unknown target: undefined
Running command: ga("gtag_my_account_id.send", {hitType: "pageview", page: "/home"})

If in fact the default tracker is no longer the t0 one and an account specific one is used, then the plug-in should probably be updated to handle this.

If not everyone is seeing this behavior, then it would seem that we need some way of setting the default account name to use.

I'm OK with submitting a PR for this but I need more input on what others are seeing for behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions