Dev guideAPI Reference
Dev guideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

Akamai EdgeWorkers

Starter Kit hosted on GitHub for running Optimizely Feature Experimentation feature flags and experiments on the Akamai EdgeWorkers service.

The Akamai EdgeWorkers service makes it possible to deploy JavaScript functions at the edge and create customized experiences for your website visitors.

Advantages of Akamai EdgeWorkers

  • Innovation – Development teams can freely build logic safeguarded against unwanted usage through security protections provided by Akamai.

  • Improved time to market – Developers can manage Akamai and deliver their code in JavaScript without having to learn a new, proprietary language.

  • Logic is executed close to users – Code is sent across the world's largest distributed network, the Akamai Edge.

  • Decreased overhead at origin – Developers can create code and not worry about internal infrastructure or increased traffic at the origin.

Akamai EdgeWorkers use cases

EdgeWorkers let you write and deploy JavaScript functions at the Edge. For example use cases, refer to the EdgeWorkers documentation.

Restrictions and Limitations

There are various restrictions and limitations to EdgeWorkers to keep in mind when running Optimizely Feature Experimentation feature flags and experiments. Refer to the official Akamai documentation for the most recent product limits and specific resource tier limitations. Also, review the known issues with EdgeWorkers.

Optimizely + Akamai EdgeWorkers Starter Kit

The Optimizely Feature Experimentation starter kit for Akamai's Edge Workers embeds and extends the Javascript Node SDK to provide a starting point for you to implement experimentation and feature flagging for your experiences at the Edge. For a guide to getting started with our platform more generally, this can be combined with the steps outlined in our Javascript Quickstart.

Identity Management

Optimizely's Feature Experimentation SDKs require a user-provided identifier to be passed in at runtime to drive experiment and feature flag decisions. This example generates a unique ID, stores it in a cookie and reuses it to make the decisions sticky. Alternatively, you can use an existing unique identifier available within your application and pass it in as the value for the OPTIMIZELY_USER_ID cookie.


You can view more information on how Optimizely Feature Experimentation SDKs assign users to feature flags and experiments with this documentation on how bucketing works.

How to use


You must have these prerequisites to use this starter kit:

Get started

  1. Create an EdgeWorker ID.

  2. Add the EdgeWorker Behavior.

  3. Install the Akamai CLI.

  4. Install the EdgeWorkers CLI.

akamai install edgeworkers
  1. Setup Authentication credentials.
  2. Create a new folder and download the Optimizely and Akamai Edgeworkers starter kit code from GitHub for the starter kit into it.
curl -L | tar --strip-components=1 -zx


wget --no-check-certificate -O - | tar --strip-components=1 -zx
  1. Install the node modules.
npm install 
  1. Add your Optimizely Feature Experimentation SDK key and flag in src/main.js. Your SDK keys can be found in the Optimizely application under Settings.

  2. Build the bundle.

npm run build
  1. Upload the bundle
akamai edgeworkers upload --bundle="dist/bundle.tgz" {WORKER_ID}
  1. Activate the version
akamai edgeworkers upload --bundle="dist/bundle.tgz" {WORKER_ID}
  • WORKER_ID – Unique ID for your EdgeWorker. This can be obtained from the Akamai control center.
  • ENVIRONMENT – The environment the EdgeWorker is being deployed on.
  • EDGEWORKER_VERSION – The custom version of the EdgeWorker as mentioned in bundle.json. This should be updated on every new deployment.
  1. Enable Advanced debug headers to receive debug logs in the response headers.

Additional resources