Reduce poor script performance

Script Management helps reduce bad performance that certain JavaScripts can cause for your site. It gathers information that can help you decide how to handle certain scripts. Script Management doesn't apply to policies that exist as embedded script elements in your site's pages. It only affects referenced scriptsexternal script resources that require a separate request.

Follow this tutorial to set up this recommended feature.


Prefer an API?

If you'd rather use an API to set up and manage, you can use a combination of ​​Akamai​'s Property Manager and Script Management APIs. Check out the tutorial.

Before you begin

Before you can configure Script Management, you need to do a few things:

  • Know the supported browsers. As an end user requests a page on your site, Script Management installs a JavaScript service worker called akam-sw.js. It's used to apply a policy that you'll create to manage scripts. It can only be installed with a supported browser:

    • Chrome (desktop and mobile)
    • Firefox (desktop and mobile)
    • Safari (desktop only)


To test your Script Management setup, you'll need to have local access to the Chrome browser.

  • Set up mPulse. ​Akamai​'s mPulse monitors the performance of your web pages based on data it collects from real end users, as "beacons." Script Management leverages these beacons to give you data regarding the scripts used by your site. A new Ion property includes the mPulse RUM sub-rule by default. Make sure it's enabled.

  • Get access to the Script Management dashboard in ​Akamai Control Center​. This is where you'll review the script usage data and set up a policy to defer or block scripts that may be affecting the delivery of your site. You need to have a ​Control Center​ account that's been granted access. If you're not sure, talk to your local ​Akamai​ admin, or contact your ​Akamai​ account team.

  • You need HTTP/3. The HTTP/3 behavior is automatically included and enabled in the Default Rule. It doesn't require any additional configuration. It just needs to be included in your rule tree where it'll be applied to requests that also apply the Script Management behavior.


HTTP/2 is still supported

Older Ion properties automatically included the HTTP/2 behavior and it was required for use with Script Management. You can keep your property configured this way, but we recommend that you update it to use HTTP/3, instead.

1. Add it in your Ion property

Script Management is added by default to the Increase availability child rule in the Default Rule in your property.

  1. Select On to enable it.

  2. Set the Script Management mode to Analysis and action. You'll be able to review script usage and create a policy to manage selected scripts. This also installs the akam-sw.js service worker for you.


Consider these points:

  • Stick to the Default Rule. The Script Management behavior needs to be applied in a rule at the root scope, such as the Default Rule. Don't use match criteria that enable it at any other scope. You can, however, add it in a child rule to the Default Rule and use a hostname match condition to restrict its use to specific Property Hostnames.

  • The Analysis-only option lets you see data on script usage on your site. You can't create a policy to manage scripts and the service worker is not installed on your site.

How the akam-sw.js service worker works

Later, you'll set up a policy for Script Management to determine how to handle the JavaScripts that Script Management has identified. Problematic ones can be deferred or blocked, while others can be left out. The akam-sw.js service worker applies this policy when users visit your site. The process follows a flow:

  1. With the Script Management Mode set to Analysis and action, your Ion property injects a script into pages on your site.

  2. When a user first requests a page, the injected script downloads and installs the akam-sw.js service worker.

  3. The service worker applies your Script Management policy to manage scripts as the user navigates the page.

  4. As the user navigates your site, scripts are blocked, deferred, or allowed based on what's set in your Script Management policy.

Script Management doesn't conflict with other JavaScript service workers you may have on your site. The akam-sw.js service worker operates at the root scope of your site. This is true regardless of what page a user is viewing. For example, when a user requests, the scope is

2. Finish your property

Continue configuring your Ion property. Then you can finalize it, test it, and go live to deliver your site.

3. Wait for data gathering

With your property live, mPulse needs some time to gather beacons. Beacons include data on the JavaScripts used for your site and they're stored based on the Property Hostname you've set in your Ion property. We recommend that you wait at least two days, up to a week, depending on the traffic volume of your site.

Get Ion property information

To move forward with this tutorial, you'll need some information from your Ion property:

  • Your Group ID. This is the group you use to organize all of the components you create for use with ​Akamai​, including the Ion property with Script Management enabled.
  • Your Ion property name.
  • The Property Hostname. When you set up your Ion property, you used your site's domain in an edge hostname that ​Akamai​ generates for you. An edge hostname is what's used to direct requests for your site to the ​Akamai​ edge network. The association between your domain and the edge hostname is what we call a property hostname, or simply a hostname.

If you don't know these values, you can access your Ion property in ​Control Center​:

  1. From ​Control Center​, select > CDN > Properties.

  2. Review the list of properties and find the one that has Script Management enabled.

  3. Make note of the Group ID, the PROPERTY NAME, and HOSTNAMES.


If your Ion property uses more than one HOSTNAME, note them all. You'll be able to view script usage for visitors to your site, based on each.

4. Manage script usage

Now, you need to move to Script Management's tools to review script usage data and use it to create a policy to manage problematic scripts.