Skip to main content
The Quickstart walks through the sensor flow once. This page explains the pieces so you can run it reliably, on any site, for as long as you need.

The two cookies

Akamai sets two cookies on the first response and reads them on every request. Send every other cookie the site sets as well, exactly as a browser would. Keeping one cookie jar per session does this for you.

The script and its data

The page contains one script tag whose path is unique per site and changes over time. Read it from each page response, fetch it through the same session, and send its body to /parse. The result, called the script data, is a small object with four fields: ver, key, dvc and din. Every sensor for this site needs it. The result stays valid for as long as the site serves the same script. Cache it on your side keyed by the script URL, and refresh it when the URL changes. Nearly every site today runs sensor version 3, which needs the script data. On the rare site still on version 2, omit scriptData from the sensor request.

Generating and posting

Call /sensor with the page URL, your User-Agent, the two cookies, the script URL and the script data. Post the returned string to the script path as {"sensor_data": "<sensor>"} with a text/plain;charset=UTF-8 content type and the page as referer. Akamai answers {"success": true} and sets a new _abck. Then read _abck:
  • It contains ~0~. You are trusted. Make the protected request.
  • It still contains ~-1~. Generate and post another sensor with the new cookie values.
Stop after three posts. If the cookie has not flipped, the sensor is not the problem; the connection is. Work through Troubleshoot a block. A few sites never flip the cookie to ~0~ and still accept the protected request after three posts, so make the request anyway before concluding you are blocked.

After the protected action

Most sites invalidate _abck when you complete a protected action such as adding to cart or logging in. Expect to run the generate-and-post cycle again before the next one. You do not need to fetch or parse the script again unless its URL has changed.

Request fields

Stepper mode

Set stepper: true on every /sensor call and pass index starting at 0 and increasing by one per post. In this mode the sensors in a session describe one continuous visit: the first covers arriving on the page, the next covers what happens after the first post, and so on. It is how our own tooling runs, and it is what the Quickstart does. Without stepper, each call produces a complete, self-contained sensor and index is ignored. That is fine for a single post, but sites that read the second or third sensor notice when each one starts from scratch.

Troubleshooting

The post itself is being refused, so the sensor never reached Akamai. Check that you post to the current script path, with the page as referer and text/plain;charset=UTF-8 as content type, through the same session that loaded the page.
Expected after a protected action. If it happens on a plain page load, the IP changed or the User-Agent differs between requests.