---
title: "Run a triggered personalization"
slug: "run-a-triggered-personalization"
abstract: "Learn how to run a triggered personalization or A/B/n test after you publish it."
---
# Run a triggered personalization

After a triggered personalization is **Live**, your application starts it by sending the triggering event. SitecoreAI then runs the configured action. The event call does not return that action's result.

Use the **Integration guide** in SitecoreAI for instructions and code specific to the selected personalization.

You can run a triggered personalization using Content SDK, REST API, or Cloud SDK.

## Open the Integration guide

To open the **Integration guide**:

1. In the navigation menu, click **Optimization**.
2. In the left sidebar, click :mdiFlaskOutline: **Tests & personalizations**.
3. Select **Triggered**.
4. Select the live triggered personalization you want to run.
   
   The **Configuration** page opens.

5. In the right pane, click the **Connect** tab.
6. Click **Open guide**.

   The **Integration guide** pane opens.
7. Select the integration method that matches your application:
   - [Content SDK](https://doc.sitecore.com/sai/en/users/sitecoreai/triggered-personalization/run-a-triggered-personalization.html#content-sdk)
   - [REST API](https://doc.sitecore.com/sai/en/users/sitecoreai/triggered-personalization/run-a-triggered-personalization.html#rest-api)
   - [Cloud SDK](https://doc.sitecore.com/sai/en/users/sitecoreai/triggered-personalization/run-a-triggered-personalization.html#cloud-sdk)

> [!note]
> The **Integration guide** provides the request or code **specific** to the selected triggered personalization and its triggering event.

## Content SDK

> [!note]
> **Before you begin**
>
> Make sure:
>
> Your application uses Content SDK 2.x and is initialized with the `events` plugin. For details, see the [Content SDK initialization guide](https://doc.sitecore.com/sai/en/developers/content-sdk/20/initializing-tracking-events-and-personalization-in-the-content-sdk.html).

To send an event for a triggered personalization from a Content SDK application:

1. In the **Integration guide** pane, click the **Content SDK** tab.

2. In **Step 1 - Send the <EVENT_IDENTIFIER> event**, click the copy icon :mdiContentCopy: to copy the TypeScript or JavaScript code.
3. Add the code to your application and run it whenever the event occurs.
      
   The SDK reuses the visitor's client ID and site information from initialization.
   
   For example:

   ```ts
   import { event } from "@sitecore-content-sdk/events";

   await event({
      "channel": "WEB",
      "language": "EN",
      "type": "<EVENT_IDENTIFIER>"
   });
   ```
    > [!note]
   > Set `type` to the same event name configured on the trigger. The sample sets `channel` to `WEB` for a website. For a mobile app, use `MOBILE_APP`. For a kiosk, use `KIOSK`. 

## REST API

> [!note]
> **Before you begin**
>
> Make sure:
>
> - You have a [Sitecore context ID](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/context-ids.html) for the environment. Include this ID in each request.
> - You have an [analytics identifier](https://doc.sitecore.com/sai/en/users/sitecoreai/create-and-manage-sites/manage-personalization-and-analytics-for-sites.html) for the site to which traffic and goal results are attributed.

To send an event for a triggered personalization using the REST API:

1. In the **Integration guide** pane, click the **REST API** tab.

2. In the **Sitecore context ID** field, enter the context ID for your environment.

   If necessary, click **View context IDs** :mdiOpenInNew: to find the ID.

3. In the **Analytics identifier** list, select the analytics identifier to use for tracking.

4. In **Step 1 - Get a client ID**, click the copy icon :mdiContentCopy: to copy the request template and send the request.

   A client ID identifies the visitor across requests. For a new visitor, retrieve the `id` from the response, store it, and reuse it as `<CLIENT_ID>` in subsequent requests for the same visitor.

   For example:

   ```bash
   curl -X POST '<baseURL>/v1/events/api/dp/v1/clients'' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'x-sitecore-contextid: <SITECORE_CONTEXT_ID>' \
     --data-raw '{
       "clientKey": ""
     }'
   ```

   Send this request from the visitor's browser or device so SitecoreAI can derive location and device information from the request.

5. In **Step 2 - Send the <EVENT_IDENTIFIER> event**, click the copy icon :mdiContentCopy:to copy the request template and send the event whenever it occurs in your application.

   Use the analytics identifier selected in step 3 and the client ID obtained in step 4.

   For example:

   ```bash
   curl -X POST '<baseURL>//v1/events/api/dp/v1/events' \
     -H 'Content-Type: application/json' \
     -H 'Accept: application/json' \
     -H 'x-sitecore-contextid: <SITECORE_CONTEXT_ID>' \
     --data-raw '{
       "clientKey": "",
       "clientId": "<CLIENT_ID>",
       "siteId": "<ANALYTICS_IDENTIFIER>",
       "channel": "WEB",
       "language": "EN",
       "name": "",
       "type": "<EVENT_IDENTIFIER>",
       "customData": null
     }'
   ```

## Cloud SDK

> [!note]
> **Before you begin**
>
> Make sure:
>
> Your application uses the Sitecore Cloud SDK and is initialized with the `events` package. For details, see the [Cloud SDK initialization guide](https://doc.sitecore.com/sdk/en/developers/006/cloud-sdk/cloud-sdk-concepts/initializing-the-cloud-sdk.html).

To send an event for a triggered personalization from a Cloud SDK application:

1. In the **Integration guide** pane, click the **Cloud SDK** tab.

2. In **Step 1 - Send the <EVENT_IDENTIFIER> event**, click the copy icon :mdiContentCopy: to copy the TypeScript or JavaScript code. 
3. Add the code to your application and run it to request the triggered personalization.
      
   The SDK reuses the visitor's client ID and site information from initialization, so you only need to specify the personalization's friendly ID and channel.

   For example:

   ```ts
   import { personalize } from "@sitecore-cloudsdk/personalize/browser";

   const personalizeResponse = await personalize({
     channel: "WEB",
     friendlyId: "triggeredpersonalization",
   });
   ```
    Set `type` and `channel` the same way as in the Content SDK sample. 