Dev guideAPI Reference
Dev guideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

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 learning 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 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 the Optimizely platform more generally, this can be combined with the steps outlined in the Javascript SDK Quickstart.

Identity management

Optimizely's Feature Experimentation SDKs require passing a user-provided identifier 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.


See How bucketing works for information on how Optimizely Feature Experimentation SDKs assign users to feature flags and experiments.

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
  5. Set up Akamai Authentication credentials.

  6. Create a 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
  7. Install the node modules.

    npm install
  8. Add your Optimizely Feature Experimentation SDK key and flag in src/main.js. Your SDK keys are in the Optimizely application under Settings.

  9. Build the bundle.

    npm run build
  10. Upload the bundle.

    akamai edgeworkers upload --bundle="dist/bundle.tgz" {WORKER_ID}
  11. 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 deployment.
  1. Enable Advanced debug headers to receive debug logs in the response headers.

Additional resources