Advanced Configuration Options

These options are less commonly used, but can be quite useful for debugging and optimizing your ATS installation.

Envelope Storage

By default, the envelope (along with a generation timestamp and version information) is written to a first-party cookie. You can alternative instruct ATS to write into a localStorage object by change the storageType attribute.

{
  "placementID": 9999,
  "storageType": "localStorage",
  "cssSelectors": [
    "input[type=email]"
  ]
}

The following information would be stored as a first-party cookie:

NameValueDomainPathExpires/Max-Age
_lr_enveyJlbnZlbG9wZSI6IkFpR05example.com/2020-08-16T13:50:04.454Z

Note that the expiration time of the cookie is one year from creation.

For localStorage, the following data would be set:

KeyValue
_lr_enveyJlbnZlbG9wZSI6IkFpR05

If you run ATS across multiple domains, consider specifying the rootDomain attribute. This will ensure that the envelope is written (and made available) to the base domain, versus the current subdomain. For example, if users input identifiers on signup.example.com but your primary site runs on ads.example.com, you could use the following configuration:

{
  "placementID": 9999,
  "storageType": "cookie",
  "rootDomain": "example.com",
  "cssSelectors": [
    "input[type=email]",
    "input[type=text]"
  ]
};
🚧

rootDomain and storageType

You must use cookies for storage if using rootDomain; localStorage is always bound to the subdomain.

Detection Options

Browser-Specific Detection

If you'd only like to run ATS on specific browsers, you can pass one more more browsers under the browsers attribute.

{
  "placementID": 9999,
  "cssSelectors": [
    "#newsletterSignup"
  ],
  "browsers": [
    "safari"
  ]
}

Valid browser values are: ["ie","edge","safari","firefox","chrome"]

Periodic Detection

By default, ATS will run when the library is first loaded. If you would like ATS to check for identifiers on a regular basis, you may configure the detection interval. This is useful if, for example, you expect an asynchronous process to populate the user's email address in a DOM element.

{
  "placementID": 9999,
  "cssSelectors": [
    "#newsletterSignup"
  ],
  "detectionInterval": 10000
}

Regex-limited Detection

ATS will run on all pages where you include and start it. If you would like to limit the pages on which ATS will attempt to run, you can pass a urlRegex in the configuration.

Note: urlRegex is case sensitive.

{
  "placementID": 9999,
  "cssSelectors": [
    "input[type=email]"
  ],
  "urlRegex": "login"
}

Logging Behavior

By default, ATS will not log any library events. However, especially during development, it can be useful to view more verbose logs.

{
  "placementID": 9999,
  "cssSelectors": [
    "#newsletterSignup"
  ],
  "logging": "debug"
}

Other potential values are ["info","warn","error"].

Envelopes passed via URL

ATS supports passing an envelope through a URL parameter and then writing it into storage.

{
  "placementID": 9999,
  "detectionType": "url",
  "urlParameter": "env"
}

If a user then visits a page with a parameter of "env", such as
https://example.com?env=At34-OJZKGF3gFFKRHLlH0TVARa72jszhHcn21zbdSYJHdQu9qhOrbd6-UhOI1UWHT2_a-DldHY from, say an email newsletter with pre-created link, the envelope will be detected, validated and then written into storage.