We recommend this approach to customers who use Akamai.
Add the following script tag in the appropriate spot inside the
<head> tag on your page.
Optimizely Performance Edge is only supported on pages served over HTTPS; it is not supported on pages that are served over insecure http://. If this is a problem for you, we want to hear about it! Contact Optimizely Support and let them know why you are interested in support for insecure HTTP.
The format of this snippet should be:
- Go to the Settings tab.
- Find the Project ID in the UI. You'll also need Account ID for the path rewriting configuration below.
In Akamai, create a new criteria that will apply the rule on paths that match your Performance Edge snippet. For example,
/optimizely-edge/<project_id>.js. This is the same path you should have included in the snippet on your site.
Next, add two behaviors below:
- Target the origin server
- Modify outgoing request path behavior
- Change the value of Origin Server Hostname field to
- Set the Forward Host Header value to
Origin Hostname. This will modify the request going from the CDN to the browser.
Replace part of the incoming path to ensure that the request from the snippet on your page is directed to its location in Optimizely.
Your configuration should match these specifications:
|Action||Regular Expression Replacement|
|Keep the query parameters||Yes|
This behavior looks for all requests whose paths start with
/optimizely-edge/<project_id>.js and replaces that string with a new path:
/edge-client/v1/<account_id>/<project_id>. In the screenshot below, this is configured for someone whose Account ID is
1234567 and Project ID is
To ensure that Akamai respects the original TTL being set on your Optimizely project settings, you must create one additional behavior, for caching.
Configure your new caching behavior to match these options:
|Caching option||Honor Origin Cache Control and Expires|
|Force Revalidation of Stale Objects||Always revalidate with origin|
|Default Max-age||120 seconds|
(This is the default on the Optimizely CDN.)
Add a downstream cacheability behavior to match this:
|Caching Option||Allow Caching|
|Cache Lifetime||Full edge TTL (max-age)|
|Send Headers||Send same headers as origin|
|Mark as Private||Off|
Note about cookies
Customers who wish to filter the cookies that are shared with the Edge Decider for targeting purposes, may implement a whitelist approach by amending their CDN configuration to modify the outgoing "Cookie" request header sent to the optimizely-edge.com. If you implement a whitelist, make sure that the following cookies used by Optimizely are on that list:
- Any other non-Optimizely cookie that you may need for experiment targeting
You can read more about the above cookies and their purpose here.
The end result:
Save your new rule. You will now be able to leverage your HTTP/2 configuration to request Optimizely.
At the end of this process, your Akamai configuration options should look like this:
To verify your setup and ensure that the correct data is received in the browser, start by checking that the Edge Decider returns a microsnippet to your browser.
- Load the webpage that has the
<script>tag on it.
optimizelyEdgereturns defined, you've implemented Performance Edge successfully.
Congratulations! You're now ready to create an experiment.
Updated 9 days ago