{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Guides","type":"markdown"},"seo":{"title":"Integrate using Akamai EdgeWorkers","description":"Everything about Mosaic Journeys, SDKs, and APIs","siteUrl":"https://developer.transmitsecurity.com/","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"integrate-using-akamai-edgeworkers","__idx":0},"children":["Integrate using Akamai EdgeWorkers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide describes how to use Akamai EdgeWorkers to integrate Agent Intelligence into your web app. For more information about Akamai EdgeWorkers, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://techdocs.akamai.com/edgeworkers/docs"},"children":["Akamai's documentation"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A Mosaic application with client credentials. Create an application in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://portal.transmitsecurity.io/"},"children":["Admin Portal"]}," if you do not already have one."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your web application must already be integrated with Akamai."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["You should be able to create and activate new Akamai EdgeWorkers."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-create-new-edgeworker-id","__idx":2},"children":["Step 1: Create new EdgeWorker ID"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Start by setting up a new EdgeWorker that will execute the code that initializes the Platform SDK, collects browser and action signals, and feeds them to Mosaic."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log in to your Akamai dashboard and navigate to EdgeWorkers."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create EdgeWorker ID"]}," and provide details such as name, group, and resource tier."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-create-and-activate-bundle","__idx":3},"children":["Step 2: Create and activate bundle"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An EdgeWorker that you just created is still inactive and doesn't contain any code to execute. To enable the worker, create a new version for it, provide the code bundle, and then activate the version for your application environment. The bundle consists of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bundle.json"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["main.js"]},"."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Go to the EdgeWorker ID details and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create version"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Provide a version number and description in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bundle.json"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add the sample code below to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["main.js"]},". Replace ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[CLIENT_ID]"]}," with the client ID from the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://portal.transmitsecurity.io/"},"children":["Admin Portal"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[ORIGIN_SERVER]"]}," with your application domain so the EdgeWorker can fetch your origin response."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Activate version"]}," to enable the EdgeWorker."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["agenticCollect: true"]}," in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["drs"]}," configuration to enable Agent Intelligence detection."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you already use Mosaic Fraud Prevention, make sure the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["clientId"]}," and the region in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["serverPath"]}," match the ones configured for your existing integration."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"import { ReadableStream, WritableStream } from 'streams';\nimport { httpRequest } from 'http-request';\nimport { createResponse } from 'create-response';\nimport { TextEncoderStream, TextDecoderStream } from 'text-encode-transform';\n\n// Some headers aren't safe to forward from the origin response through an EdgeWorker on to the client.\n// For more information, see the tech docs on create-response:\n// https://techdocs.akamai.com/edgeworkers/docs/create-response\nconst UNSAFE_RESPONSE_HEADERS = ['content-length', 'transfer-encoding', 'connection', 'vary',\n  'accept-encoding', 'content-encoding', 'keep-alive',\n  'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'upgrade'];\n\nclass HTMLStream {\n  constructor () {\n    let readController = null;\n    const agentIntelligenceHandlerStr = `\n          <script src=\"https://platform-websdk.transmitsecurity.io/platform-websdk/2.x/ts-platform-websdk.js\" defer=\"true\" id=\"ts-platform-script\"></script>\n          <script>\n             document.getElementById(\"ts-platform-script\").addEventListener(\"load\", function() {\n                 window.tsPlatform.initialize({\n                    clientId: \"[CLIENT_ID]\",\n                    drs: {\n                      agenticCollect: true, // Enables Agent Intelligence detection\n                      serverPath: \"https://api.transmitsecurity.io/risk-collect/\", // Set serverPath based on your region or custom domain\n                    }\n                 });\n             });\n          </script>\n          </head>\n    `;\n    const headTag = '</head>';\n    this.readable = new ReadableStream({\n      start (controller) {\n        readController = controller;\n      }\n    });\n\n    async function handleTemplate (text) {\n      const startIndex = text.indexOf(headTag);\n      if (startIndex !== -1) {\n        text = text.replace(headTag, agentIntelligenceHandlerStr);\n      }\n      readController.enqueue(text);\n    }\n\n    let completeProcessing = Promise.resolve();\n    this.writable = new WritableStream({\n      write (text) {\n        completeProcessing = handleTemplate(text, 0);\n      },\n      close () {\n        completeProcessing.then(() => readController.close());\n      }\n    });\n  }\n}\n\nexport function responseProvider () {\n  return httpRequest(\"[ORIGIN_SERVER]\").then(response => {\n    return createResponse(\n      response.status,\n      getSafeResponseHeaders(response.getHeaders()),\n      response.body\n        .pipeThrough(new TextDecoderStream())\n        .pipeThrough(new HTMLStream())\n        .pipeThrough(new TextEncoderStream())\n    );\n  });\n}\n\nfunction getSafeResponseHeaders(headers) {\n  for (let unsafeResponseHeader of UNSAFE_RESPONSE_HEADERS) {\n    if (unsafeResponseHeader in headers) {\n      delete headers[unsafeResponseHeader];\n    }\n  }\n  return headers;\n}\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-validate-in-mosaic","__idx":4},"children":["Step 3: Validate in Mosaic"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After you activate the EdgeWorker and drive traffic through the pages covered by your routes, open ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent Intelligence"]}," in Mosaic and start with ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Sessions"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Confirm that session records begin appearing for the applications and routes covered by your integration."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Review fields such as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Activity Surface"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Start Time"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent Platform"]},", and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Origin Type"]}," to verify that the expected traffic is being collected."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open individual sessions to inspect additional details such as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["IP Address"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Country"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OS"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Browser"]},", and path data when available."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If data doesn't appear, verify the following:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The EdgeWorker is active on the routes where you expect HTML responses"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The Platform SDK script is being injected into the page source"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["serverPath"]}," matches the correct region or your custom domain"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your CSP allows the Platform SDK script and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["risk-collect"]}," endpoint. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/quick_start/enable_communication/"},"children":["Enable API communication"]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["First agent platforms typically surface within hours of activation. Agentic traffic volume builds gradually over the first several weeks—check trends across multiple weeks rather than a single day."]}]}]},"headings":[{"value":"Integrate using Akamai EdgeWorkers","id":"integrate-using-akamai-edgeworkers","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Step 1: Create new EdgeWorker ID","id":"step-1-create-new-edgeworker-id","depth":2},{"value":"Step 2: Create and activate bundle","id":"step-2-create-and-activate-bundle","depth":2},{"value":"Step 3: Validate in Mosaic","id":"step-3-validate-in-mosaic","depth":2}],"frontmatter":{"title":"Integrate using Akamai EdgeWorkers","markdown":{"toc":{"depth":2}},"seo":{"title":"Integrate using Akamai EdgeWorkers"}},"lastModified":"2026-08-19T14:36:48.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/agent-intelligence/integrate_akamai","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}