The Engine API 2.0 provides a flexible way to integrate SiteSpect's experimentation platform into environments beyond the web, such as mobile apps, kiosks, and other applications.
The Engine API 2.0 requires a domain to be configured and routed through SiteSpect. Alternatively, a subdomain can be configured as a standalone endpoint (e.g. sitespect.yoursite.com).
To learn more about creating campaigns and metrics for Engine API 2.0, see How to Create Campaigns Campaigns and Metrics for Engine API 2.0.
Engine API 2.0 Endpoint
To retrieve assignments, variations, feature flags or capture metrics using the Engine API 2.0, make a POST request to the following endpoint:
POST /__ssobj/static/endpoint.json
The response will include data about the campaigns the user is assigned to, the variations within those campaigns, feature flags, metrics, and user information. This allows you to dynamically modify the user experience based on their assignment.
Note: If you are using the AdBlocker feature, ensure you replace __ssobj
with the specific path configured for your site.
Initial configuration
Enabling Cookie Support
Cookie support is essential for the Engine API 2.0 to function properly. Be sure to enable cookies on mobile apps and other non-browser environments to maintain consistent user assignments throughout a session and across multiple visits.
For web environments on both mobile and desktop, cookie support is typically enabled by default and requires no additional configuration.
User Agent Header for API Calls
When making calls to the Engine API 2.0, ensure you include the User-Agent header of the requesting device or application. This header is essential for accurate tracking and assignment.
Disabling Robot Detection
Make sure that all calls to the Engine API 2.0 include a header to disable robot detection to maintain consistent tracking and response accuracy across API requests.
Your SiteSpect site needs to be configured to support a Robot Detection Header. When this header is present, SiteSpect does not perform its usual bot check. (Applies to both ARD and IAB.)
If your site does not include this configuration, contact your customer success team.
Disabling Skip Assignment When First Hit Is Internal Content
The new Engine API 2.0 is not compatible with the Skip Assignment When First Hit Is Internal Content feature at this time.
Example API Request with Payload
Here’s an example of a POST call to the Engine API 2.0 to retrieve assignments, variations, and metrics. This example includes a request payload to provide context for triggering variations and metrics.
POST /__ssobj/static/endpoint.json
Payload:
Example API Response
The response from the API provides a detailed breakdown of the user’s campaign assignments, variations, metrics, user information, and payload:
Breakdown of the API Response
1. Assignments
Use the assignments
section to determine which campaigns and variation groups the user is assigned to. This helps you control which variations are shown to the user in your A/B testing and feature flagging scenarios.
Example:
2. Variations
This section is optional and allows for more granular adjustments within a variation group. Use variations
to control which specific changes are displayed based on user segments and app context. Variations are triggered based on the data in the API request payload.
Example:
3. Metrics
The metrics
section contains details about any metrics captured for the user. Metrics are triggered based on the data exposed in the API request payload.
4. User Information
The userInfo
section provides contextual information about the user.
- userGuid: The global unique identifier for the user.
- visitCount: The total number of visits by the user.
- userAgent: The browser user agent string.
- geo: Geolocation details for the user, such as country, region, city, latitude, and longitude.
Example:
4. Payload
Use the payload
section to pass additional key-value pairs that provide dynamic data for updating your application in real-time. These attributes allow you to customize the user experience based on specific user properties, experiment data, or contextual information defined within the SiteSpect UI.
Example: