Additional Service Worker tools

The akam-sw.js service worker applies your Script Management policy when users visit your site. Management of it is automated through the Script Management dashboard or API operations. However, you can manually interact with it if necessary.

Manually update the service worker

📘

This is automated through specific operations

Before you attempt to use this manual method, the service worker automatically updates to the newest version when you do any of these:

  • Update your Ion property. If Script Management is enabled and its mode is set to Analysis and action, the service worker will also be updated, regardless of the change you make to your property.
  • Activate a new version of your policy. If you make any kind of update to your policy, using the Script Management dashboard or API, the service worker will be updated.

Use the API

This isn't so much a manual method. If you use this operation to make any change to your policy, the service worker will also be updated to the most recent version.

Use the dashboard

Mouse-over About Script Management at the top right. Information regarding each ​Akamai​ network version of your policy is displayed. If an update to the service worker is available, you'll see a link next to the network that needs the update. Click this link to update to the most recent version.

👍

You should update the staging network version first and test it before updating the service worker for the production version of your policy.

Manually install the service worker

Script Management automatically injects its akam-sw.js service worker into the pages of your site, when you enable it in your Ion property using the Analysis and action mode. However, if you've only enabled it using the Analyisis mode, you can use an external script to manually install the Script Management service worker on your site.

Using this method automatically sets Script Management to Action and analysis mode.

📘

Script Management doesn't support existing custom service workers when they're enabled using an external script. If you have your own service workers on the site, don't use this method.

  1. Apply an external script tag on the target page on your site, using one of these methods:
MethodDetail

Origin injection method

  1. Add the PMUSER_SM_NO_EDGE_INJECT variable and set it to TRUE.

  2. Insert the following script tag in the HTML code at the end of the section

    <script async defer type="text/javascript" src="/akam-sw-setup.js"></script>`
    

Auto-injection method

Add the PMUSER_SM_INJECT_AS_EXTERNAL variable and set it to TRUE before the call to the Script Management template.

  1. To test the results, validate that the script tag in option A is injected at the bottom of the section for all pages on the specified host. Also, verify that the old snippet is no longer injected.