Skip to content

Allow supporting gtag set command arguments #68

@felixarntz

Description

@felixarntz

gtag supports a set command.

While this is technically a command that can simply be invoked via the gtag function exposed in the Google Analytics JS code snippet, resources like https://developers.google.com/tag-platform/devguides/cross-domain suggest that (at least) certain set command invokations need to happen before the main initialization logic of Analytics (i.e. where it sets the Analytics property ID).

While technically a call to the command could happen in custom JS code injected after the snippet created by TPC, this wouldn't work correctly if it was required to happen prior to initialization.

It is not clear at the moment, whether such a set call has to happen prior to initialization, or whether that's just the arbitrary choice of the recommended code snippet in the above documentation. It may be worth investigating and considering support for this though, given the reference code snippet.

Last but not least: Note that linker may not be the only argument with such special treatment. For example, the Google Site Kit plugin for WordPress sets another arbitrary argument prior to initialization, which is undocumented, however was requested to be included for the implementation, partly to recognize Google Site Kit traffic: https://github.com/google/site-kit-wp/blob/59a424e013ece675920856b83b7fccbecae694c9/includes/Core/Tags/GTag.php#L133

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions