Set up Script Management
script elements in your site's pages. It only affects referenced scripts—external script resources that require a separate request.
Follow this workflow 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 workflow.
1. Meet some prerequisites
Before you can configure Script Management, you need to do a few things:
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.
Enable HTTP/2. The HTTP/2 behavior is automatically included in the Accelerate delivery rule. It doesn't require any 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.
Are you participating in the HTTP/3 Beta?
If you are, Script Management is supported with HTTP/3. Review the HTTP3 (Beta) documentation to get it set up properly and understand any caveats that apply to its use.
2. 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.
Select On to enable it.
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.jsservice 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.
akam-sw.js service worker works
akam-sw.jsservice worker works
akam-sw.js service worker applies this policy when users visit your site. The process follows a flow:
With the Script Management Mode set to Analysis and action, your Ion property injects a script into pages on your site.
When a user first requests a page, the injected script downloads and installs the
The service worker applies your Script Management policy to manage scripts as the user navigates the page.
As the user navigates your site, scripts are blocked, deferred, or allowed based on what's set in your Script Management policy.
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
www.example.com/products/widgets/index.html, the scope is
3. Finish your property
Continue configuring your Ion property. Then you can finalize it, test it, and go live to deliver your site.
4. Wait for data gathering
Get Ion property information
To move forward with this workflow, 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:
From Control Center, select ☰ > CDN > Properties.
Review the list of properties and find the one that has Script Management enabled.
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.
5. 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.
Updated 17 days ago