---
updatedAt: 2026-04-07T10:11:17.000Z
agentTools:
  siteIndex: https://developers.liveramp.com/llms.txt
  projectIndex: https://developers.liveramp.com/authenticatedtraffic-api/v1.0/llms.txt
---

# ats.js Functions

# `ats.start(config);`

Typically, `ats.start(config);` is the only function you will need to call.

This function should be placed into its own `<script>` tag and called with your [configuration object](https://developers.liveramp.com/authenticatedtraffic-api/docs/atsjs-configuration-options) just after the `<script>` tag for ats.js. The library will not begun to run processing or detection until it is started.

# `ats.retrieveEnvelope(callback);`

Fetch envelope from configured storage; the callback function is optional. If the function is called without a callback, a promise will be returned. If function is called with callback, an envelope value will be returned.

### Retrieving envelopes from an iframe

You can call for envelopes from within an iframe (or nested iframe) using `postMessage`. As an example, implementing the following will request an envelope from the parent:

[block:code]
{
  "codes": [
    {
      "code": "    function dispatchEnvelopeRequestEvent() {\n        try{\n            top.postMessage('ats-liveramp-envelope-request','*');\n        }catch(e){\n            if(typeof(winRef.contentWindow) != 'undefined') {\n                top.contentWindow.postMessage('ats-liveramp-envelope-request','*');\n            }\n        }\n    }",
      "language": "javascript",
      "name": "IFrame Envelope Request"
    }
  ]
}
[/block]

You will then need to receive and process the result from the parent.

[block:code]
{
  "codes": [
    {
      "code": "    function receiveEnvelope(event) {\n        if(event && event.data && event.data.message === 'ats-liveramp-envelope-result'){\n            console.log(event.data.result,event.origin);\n        }\n    }\n    window.addEventListener('message', receiveEnvelope, false);",
      "language": "javascript",
      "name": "Envelope Response"
    }
  ]
}
[/block]

# `ats.triggerDetection();`

This function will (re)scan DOM elements with the CSS selectors specified in your configuration. You can call this function if the ats.js library has been started.