Skip to content

The Nameless Analytics Client-side configuration variable is a highly customizable GTM custom template designed to configure the settings of Nameless Analytics Client-side tracker tag.

Notifications You must be signed in to change notification settings

tommasomoretti/nameless-analytics-client-side-tracker-configuration-variable

Repository files navigation

Light Mode Dark Mode

Client-side tracker configuration variable

The Nameless Analytics Client-side tracker configuration variable is a highly customizable GTM custom variable template designed to configure the settings of Nameless Analytics Client-side tracker tag.

For an overview of how Nameless Analytics works start from here.

Table of contents:

Variable UI

This is the UI of the Client-side tracker configuration variable. This variable will handle settings like sets user and session parameters, common event parameters, user ID, user consent mode, cross-domain tracking, logging in JavaScript console and more.

Nameless Analytics - Client-side tracker configuration variable UI

Basic settings

Endpoint domain name

The domain name of the server-side GTM instance. The tag assumes the protocol is HTTPS.

Example: gtm.domain.com

Endpoint path

The endpoint path where the Nameless Analytics Server-side Client Tag listens.

Example: /nameless_analytics/endpoint

User data

User parameters

Add user parameters for all events. The parameters will be added in the user_data object in the payload.

They are:

  • written in Google Cloud Firestore every time they change --> latest values
  • read and sent to BigQuery with the current parameter status --> current values

Please note: if a parameter has the same name as another, it can override or be overridden depending on where it was set.

This is the hierarchy of event parameter importance:

Server-side user parameters overrides User parameters

Add User ID

Add User ID parameters in user_id field.

This parameter can be overridden modifying the users ID in Nameless Analytics Server-Side client tag.

Add user level parameters

Add user level parameters in user_data object in the payload. Values accepted: strings, integers, float and json.

These parameter can be overridden adding user parameters in Nameless Analytics Server-side client tag.

Session data

Session parameters

Add session parameters for all events. The parameters will be added in the session_data object in the payload.

They are:

  • written in Google Cloud Firestore every time they change --> latest values
  • read and sent to BigQuery with the current parameter status --> current values

Please note: if a parameter has the same name as another, it can override or be overridden depending on where it was set.

This is the hierarchy of event parameter importance:

Server-side session parameters overrides Session parameters

Add session level parameters

Add session level parameters in session_data object in the payload. Values accepted: strings, integers, float and json.

These parameter can be overridden adding session parameters in Nameless Analytics Server-side client tag.

Event data

Event parameters

Add event parameters for all events. The parameters will be added in the event_data object in the payload.

Please note: if a parameter has the same name as another, it can override or be overridden depending on where it was set.

This is the hierarchy of event parameter importance:

Server-side event parameters overrides Specific event parameters overrides Shared event parameters overrides dataLayer parameters overrides Standard parameters

Add shared event parameters

Add shared event parameters in event_data object in the payload. Values accepted: strings, integers, float and json.

These parameters can override:

  • default event parameters
  • dataLayer event parameters added in Nameless Analytics Client-side tracker tag

These parameters can be overridden by:

  • event parameters added in Nameless Analytics Client-side tracker tag
  • event parameters added in Nameless Analytics Server-side client tag

Page view settings

Add page status code

Add page status code to the request in the event_data when a page_view happens. This setting will be visible in the UI only when the event name is equal to page_view.

Add page status code

Please note: this will not work for virtual_page_view.

Advanced settings

Respect Google Consent Mode

When Google Consent Mode is present on website and respect_consent_mode is enabled, the events are sent only if a user consents.

  • When analytics_storage is equal to denied, the tag waits until consent is granted.
  • When analytics_storage changes from denied to granted, all pending tags for that page will be fired in execution order.
  • When analytics_storage is equal to granted, the tag sends the hits to the server-side Google Tag Manager endpoint without temp_client_id and temp_session_id.

When Google Consent Mode is not present on website or Google Consent Mode is present on website and respect_consent_mode is disabled, all events are sent regardless user consents.

Enable cross-domain tracking

Enables the transfer of client_id and session_id data across two or more websites via URL GET parameter. This allows Nameless Analytics tags to merge into a single session the individual sessions that would otherwise be created when visiting another domains.

Please note: the server-side GTM container must olso be configured correctly to make cross-domain tracking works. Read the relative documentation.

Enable cross domain tracking and add the domains one for row.

Enable cross-domain tracking

If the domains do not share the same Nameless Analytics Server-side client tag

With this configuration the endpoint domain can be static as described here.

If multiple domains share the same Nameless Analytics Server-side client tag

With this configuration the endpoint domain must be dynamic.

This is necessary because when the Nameless Analytics Server-side client tag claims a request, it responds with a Set-Cookie header that includes the Domain attribute. To correctly set the Nameless Analytics cookies, the Domain attribute must match the domain or be a subdomain of the webpage’s domain that has sent the request.

Therefore:

  • Requests originating from domain_1.com must be sent to gtm.domain_1.com
  • Requests originating from domain_2.com must be sent to gtm.domain_2.com

Otherwise the Set-Cookie header will not work:

Enable cross-domain tracking

To save cookie correctly, create a regex lookup table to send requests to different domains endpoint. With this configuration the Domain attribute in the Set-Cookie header will match the request origin.

Enable cross-domain tracking

How cross-domain tracking works

Cross-domain functionality depends of how Respect Google Consent Mode is set.

If enable_cross_domain_tracking option is enabled, the Nameless Analytics Client-side tracker tag will set a JavaScript event listener on every link click.

When a user clicks on a cross-domain link, the event listener sends a get_user_data request to the Nameless Analytics Server-Side client tag to retrieve cookies value since they are not accessible from the browser (they are HttpOnly). The Nameless Analytics Server-Side client tag responds with the cookie values and the JavaScript event listener decorates the URL with a parameter named na_id with the current session_id.

After that, the user is redirected to the destination website.

When the user lands on the destination website and a page_view event is triggered, the Nameless Analytics Client-Side tracker tag checks if there is a na_id parameter in the URL. If it is present, the hit will contain a cross_domain_id parameter.

The Nameless Analytics Server-Side client tag will add it to the request and set back the cookies with those values.

If enable_cross_domain_tracking option is disabled or respect_consent_mode is true and analytics_storage is denied, the Nameless Analytics Client-side tracker tag will not set any listener or will not send any hit if the consent was change from granted to denied.

Customize source and campaigns url parameters

Override the default URL query parameter names used as source and campaign parameters. By default, these values are taken from standard UTM parameters.

Change default JavaScript page view event names

Override the default JavaScript event names for page_view and virtual_page_view. Update these values if the Nameless Analytics Client-side Tracker Tag is triggered by a JavaScript event name that differs from gtm.js (for page views) or gtm.historyChange (for virtual page views).

Please note: When an event is fired, the Nameless Analytics Client-side tracker tag checks if the JavaScript event that triggered the tag is gtm.js or gtm.historyChange. If it is, the tag generates a new page_id value. For this reason, the page_view event must be the first event on a page. Any event sent on a page prior to the first page_view event will be ignored because it lacks a page_id.

Load main library from custom location

Override the default location of the main library.

Add current dataLayer state

Add the current state of the dataLayer in dataLayer field in the payload.

Enable logs in JavaScript console

Enable console log for all events in JavaScript console.


Reach me at: Email | Website | Twitter | Linkedin

About

The Nameless Analytics Client-side configuration variable is a highly customizable GTM custom template designed to configure the settings of Nameless Analytics Client-side tracker tag.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published