Skip to main content

User location & device details

Akamai makes user location and device details available to EdgeWorkers. Uniform enables you to use these details to configure personalization instructions.

tip

For more information on this topic, see the Akamai documentation for User Location Object and Device Object.

Add quirk definitions

User location and device details are associated with a specific visitor. In Uniform, quirks give you a way to associate any information you want with a visitor. Quirks can then be used as conditions in personalization instructions.

Before you can configure personalization instructions that use user location and device details, quirks must be be defined. The Akamai connector handles this for you.

  1. In Uniform, open your project.

  2. Navigate to the Integrations tab.

    browse-integrations
  3. Click Akamai.

    add-to-project
  4. Click Add to project.

    integration-added
  5. Navigate to Personalization > Quirks.

    available-quirks
    About this step

    You will see a list of quirks that were added by the Akamai integration.

Identify details to include

In the previous section you added quirks to your Uniform project, but just because a quirk is defined doesn't mean the value will be populated for your visitors. Values for the quirks defined by the Akamai integration are available from Akamai, but you must add some logic to your EdgeWorker to select the values you want to use.

The EdgeWorker uses the Akamai proxy edge handler function to run the personalization instructions. When you call this function, you can specify the user location and device details you want to make available as quirks.

The following code sample demonstrates how to do this:

import { createResponse } from 'create-response';
import { createAkamaiEdgeContext, createAkamaiProxyEdgeHandler } from '@uniformdev/context-edge-akamai';

export async function responseProvider(request) {
const manifest = { project: {} };
const context = createAkamaiEdgeContext({ request, manifest });
const handler = createAkamaiProxyEdgeHandler();
const { processed, response } = await handler({
context,
request,
quirks: {
userLocation: ["city", "country"],
device: ["isMobile"],
}
});
return createResponse(response.status, response.headers, response.body);
}
tip

For more information on the quirks that are available, see the package reference for the Akamai integration.

Next steps

Now you can create signals using the quirks you added.

configure-signal