Tracker initialisation

 

Foreword

Before starting, please download our JavaScript library, or push it onto our CDN, from within the Tag Composer interface.

This library enables you to:

  • Set up your tagging perimeter/scope (site, domain used to write cookies, etc.).
  • Select desired features via configurable plugins.

Once the library is set up, you must call it inside the <head> of your page.

 

Initialisation

Tracker initialisation is done via JavaScript methods to be inserted.

The constructor ATInternet.Tracker.Tag() can take two arguments, a first one intended for overload Tracker configuration and a second intended for add context values.

 

Configuration

The file “smarttag.js” contains the default configuration defined during generation in Tag Composer. It’s possible to overload a part of the configuration by specifying the new settings during initialisation.

Example:

Here, the “secure” setup variable was force-set to true.

List of basic setup variables that can be overloaded:

  • The secure variable enables the sending of information in a secure manner, or not. Specify true in the case of an HTTPS protocol, and false for an HTTP protocol.
  • The disableCookie variable, if set to true, enables you to block the writing of tracker cookies (first and third).
  • The cookieDomain variable enables you to specify the domain for the writing of cookies. In cases where this parameter is empty (cookieDomain: ''), the domain of the current page will be used.

  • The cookieSecure variable, if set to true, enables you to add the option ‘secure’ for the writing of tracker cookies (first). Please be aware that ‘secure’ cookies will only work on HTTPS pages.
  • The ignoreEmptyChapterValue variable, if set to true, enables you to ignore chapters without value.

>= 5.5.0

Other setup variables exist, but require advanced knowledge of the Tracker (see Appendix).

 

Context

Its also possible to force context values which will be added and shared between tags according to the type.

Example :

Here, the campaign value defined in “forcedCampaign” will be added in page tags.

List of context variables that can be declared :

  • The forcedCampaign enables you to declare and force a campaign.
  • The forcedReferer variable enables you to declare and force a referer.
 

Basic tag

Here is an example of a tag allowing you to measure a pageview with the label “Page Name”:

 

Appendix

Setup variables that can be overloaded:

Name Default value Description Version
secure false Force the sending of information in a secure manner (HTTPS)
disableCookie false Enables you to block the writing of tracker cookies (first and third)
cookieDomain TagComposer value Domain for the writing of cookies. If this parameter is empty (cookieDomain: ''), the domain of the current page will be used
cookieSecure false Add option ‘secure’ for the writing of tracker cookies (first) >= 5.5.0
ignoreEmptyChapterValue false Ignore chapters without value >= 5.5.0
site TagComposer value Site number
log TagComposer value Subdomain of the collector AT Internet. Deprecated since 5.13.0, see collectDomain < 5.13.0
logSSL TagComposer value subdomain of the secured (HTTPS) collector AT Internet. Deprecated since 5.13.0, see collectDomain < 5.13.0
domain TagComposer value Domain of URL hits. Deprecated since 5.13.0, see collectDomain < 5.13.0
pixelPath /hit.xiti Path toward the pixel file for hits
preview false Force the sending of page hits in cases of loads in preview mode on the Safari browser (true: measurement enabled, false: measurement disabled)
collectDomain TagComposer value Data collection domain >= 5.13.0
collectDomainSSL TagComposer value Secured data collection domain >= 5.13.0
Was this post helpful?
Yes
No
Last update: 08/10/2018