Learn how to create campaigns and metrics in the SiteSpect UI for a/b testing with the Engine API 2.0.
Overview of the Engine API 2.0 (Beta)
All requests to the Engine API 2.0 are made through a single endpoint:
/__ssobj/static/endpoint.json
- Receive relevant variations or feature flags based on audience evaluation and serve them dynamically.
- Capture metrics through key-value pairs in your API request payloads.
- Automatically evaluate audience segments based on the request headers.
- Dynamically update your app by defining and updating additional key-value pairs directly through the SiteSpect UI.
For more information on the Engine API 2.0, see Engine API 2.0 Reference.
1. Capturing Metrics
In Engine API 2.0, metrics are captured by sending key-value pairs to the endpoint. These key-value pairs are matched with Metrics you set up in SiteSpect, enabling you to track user actions like purchases or clicks.
How to Create a Metric in the SiteSpect UI
- Log in to SiteSpect and navigate to the Metrics section.
- Click New Metric.
- Select Event type and Trigger method.
- Choose API Endpoint as a Trigger, which allows capturing key-value pairs from the Engine API 2.0.
- Add another trigger, and choose Request Payload.
- Configure the trigger based on the key-value pairs, such as matching
"user-status": "logged-in"
. - Save the Metric and use it in your campaigns.
For more detailed instructions, visit Creating a Metric.
2. Audience Evaluation
Audiences are used to determine which Campaigns a user is assigned to.
Audiences are evaluated automatically based on information available in the API request. SiteSpect matches users to the appropriate audience using defined criteria such as device type, location, or other attributes. The API responds with the relevant campaign assignments based on the audience the user matches.
Most audience types available in SiteSpect are compatible with Engine API 2.0, including:
- Geolocation: Target users based on their geographical location.
- Device Type: Target mobile, desktop, or tablet users.
- URL Parameters: Target users based on query string parameters or custom URL values passed in the API request.
- And more.
Entry Page Source audiences are not compatible with Engine API 2.0.
For more information on how to create audiences, visit Creating a New Audience.
3. Trigger Evaluation
Triggers are used to define specific conditions that determine when a specific variation should be applied.
Unlike audiences, which are based on predefined criteria like device type or location, triggers are evaluated against the request payload sent to the API. This allows for precise control over when variations are shown, based on the data you provide in your API requests.
How Triggers Work in the Engine API 2.0
When you make an API request to retrieve variations, triggers in your campaign are evaluated using the key-value pairs in the request payload. A trigger specifies the conditions that must be met for a variation to be served. If the conditions in the payload match the trigger, SiteSpect will serve the associated variation.
Example: Request Payload with Trigger Evaluation
Here’s an example of how a trigger can be evaluated based on a request payload:
Request Payload Example:
user-status
is "logged-in"
and the view-name
is "product-details"
. If these conditions are met, SiteSpect will serve the appropriate variation for logged-in users viewing the product details page who are adding an item to the cart. Define Triggers in the UI
To evaluate triggers against the Engine API 2.0 choose a Page Category or Global Trigger that matches on the API Endpoint. You can then include an additional Request Payload trigger and define the specific criteria:
For more information on defining triggers, visit Defining Triggers.
4. Creating Campaigns for A/B Testing and Feature Flags
You can set up campaigns to deliver variations for A/B Testing or to manage Feature Flags. These campaigns allow you to experiment with different changes and control the visibility of features based on predefined criteria.
To create an A/B Testing campaign in the SiteSpect UI:
- Log in to SiteSpect and click on New Campaign.
- Select A/B Campaign as the type.
- Name your campaign to clearly indicate its purpose, such as “Homepage Button Test” or “Mobile Layout Experiment.”
- In the General section, configure any necessary settings, just as frequency and set.
- Under the Variation section:
- A Variation Group (VG) is automatically created by default along with its corresponding variation. This allows you to set up a basic A/B test right away.
- Rename the Variation Group to clearly reflect the content being tested. For example, you might rename it to “New Home Screen Hero” or “New Header Layout.” This helps ensure clarity when analyzing the test results.
- You can create additional Variation Groups as needed for an A/B/n test.
- Add a Trigger to match on the API Endpoint: choose Page Category or Global Trigger and select API Endpoint.
- Optional: add additional Request Payload triggers to evaluate against any key-value pairs exposed in the API request (e.g.,
"user-status": "logged-in"
or"view-name": "product-details"
. - Select Metrics that track user behavior, such as clicks, purchases, or form submissions.
- In the Audience section, assign the campaign to the appropriate Audiences (e.g., mobile users, returning users).
- Save and activate your campaign.
Once the campaign is active, SiteSpect will evaluate users based on the variation triggers and audience definitions, serving the relevant variation as part of the A/B or A/B/n test.
For more information, visit Creating an A/B Campaign.