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:
-
In the navigation menu, click Optimization.
-
In the left sidebar, click Tests & personalizations.
-
Select Triggered.
-
Select the live triggered personalization you want to run.
The Configuration page opens.
-
In the right pane, click the Connect tab.
-
Click Open guide.
The Integration guide pane opens.
-
Select the integration method that matches your application:
The Integration guide provides the request or code specific to the selected triggered personalization and its triggering event.
Content SDK
Make sure:
Your application uses Content SDK 2.x and is initialized with the events plugin. For details, see the Content SDK initialization guide.
To send an event for a triggered personalization from a Content SDK application:
-
In the Integration guide pane, click the Content SDK tab.
-
In Step 1 - Send the <EVENT_IDENTIFIER> event, click the copy icon to copy the TypeScript or JavaScript code.
-
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:
NoteSet
typeto the same event name configured on the trigger. The sample setschanneltoWEBfor a website. For a mobile app, useMOBILE_APP. For a kiosk, useKIOSK.
REST API
Make sure:
- You have a Sitecore context ID for the environment. Include this ID in each request.
- You have an analytics identifier for the site to which traffic and goal results are attributed.
To send an event for a triggered personalization using the REST API:
-
In the Integration guide pane, click the REST API tab.
-
In the Sitecore context ID field, enter the context ID for your environment.
If necessary, click View context IDs to find the ID.
-
In the Analytics identifier list, select the analytics identifier to use for tracking.
-
In Step 1 - Get a client ID, click the copy icon to copy the request template and send the request.
A client ID identifies the visitor across requests. For a new visitor, retrieve the
idfrom the response, store it, and reuse it as<CLIENT_ID>in subsequent requests for the same visitor.For example:
Send this request from the visitor's browser or device so SitecoreAI can derive location and device information from the request.
-
In Step 2 - Send the <EVENT_IDENTIFIER> event, click the copy icon :mdiContentCopy
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:
Cloud SDK
Make sure:
Your application uses the Sitecore Cloud SDK and is initialized with the events package. For details, see the Cloud SDK initialization guide.
To send an event for a triggered personalization from a Cloud SDK application:
-
In the Integration guide pane, click the Cloud SDK tab.
-
In Step 1 - Send the <EVENT_IDENTIFIER> event, click the copy icon to copy the TypeScript or JavaScript code.
-
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:
Set
typeandchannelthe same way as in the Content SDK sample.