Skip to main content

Config

Events, Recommendations, and Search API calls require customer ID and session ID to personalize content and capture user trends.

IDs allow the system to function. They are randomly generated and are not personally identifiable since we ingest no personal data.

The Config API call is responsible for generating these IDs.

A new customer ID must be created for each new customer, while a new session ID should be generated for every new session.

A session initiates when a user either opens your website or app in the foreground or views a page or screen and no session is currently active, for example, their previous session has timed out. By default, a session ends or times out after 30 minutes of user inactivity.

For creating a fresh set of IDs, the API call should be made without providing a customer ID.

However, if the purpose is to generate a new session ID for an existing customer, the current customer ID should be included in the call. This will generate a new session ID linked to the provided customer ID.

You will note that session duration default is a large number, this is arbitrary since a session could be active for a long period of time. Session IDs exist within PA indefinitely for reporting purposes. However, you must govern expiry and new assignment based on best practice outlined above.

  • Method: GET
  • URL: https://<PA_END_POINT>/3.0/config
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer ACCESS_TOKEN
  • Query Parameters:
    • customerId: If generating sessionId for an existing customer, provide the current customerId; otherwise, skip this parameter.
    • isMobile: If creating a new customer ID and the user is browsing from a mobile device, set it to true; otherwise, skip this parameter.
  • Returned Payload:
    {
    "payload": {
    "customerId": "xxxxxxxxxxxxxx",
    "session": {
    "id": "xxxxxxxxxxxxxx",
    "duration": 1800000
    },
    "controlCohort": true
    },
    "type": 1,
    "code": 0
    }
    • payload.customerId: If a specific customer ID was provided during the API call, that same customerId will be returned; otherwise a newly generated one will be returned.
    • payload.session: This includes the unique sessionID and its duration, which gets cached within system memory - note that sessions do not expire.
    • payload.controlCohort: Indicates whether or not customers have been placed in control cohorts on your website; returns true if they are part of this cohort or false if not.
    • type: A system parameter always designated as 1 for successful responses
    • code: Another system parameter is always set at zero when there's no issue with processing requests

Here’s an example code snippet using JavaScript’s Fetch API:

const myHeaders = new Headers();
myHeaders.append("Authorization", "ACCESS_TOKEN");
myHeaders.append("Content-Type", "application/json");

const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect:'follow'
};

fetch('https://<PA_END_POINT>/3.0/config', requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error(error));

Summary:

This document discusses the necessity of customer and session IDs for personalizing content, as well as the process of generating and managing these IDs.

  • Customer and session IDs are essential for personalization and user trend capture, generated via the Config API call.

  • A new customer ID is required for each new customer, while a new session ID should be created for every new session.

  • The default session duration is 30 minutes of inactivity, but can be managed based on best practices.

  • The GET method with specific headers and query parameters is used to generate customer and session IDs.

  • The returned payload includes the generated or existing customer ID, unique session ID with its duration, and other system parameters.