Making API Calls

When an Engine API Campaign is Active, you can make API calls to the Engine API domain or your own (already implemented) domain using the path “__ssapi”, if you are routing through SiteSpect. A GET call makes an Assignment and returns Campaign data, showing all Metrics that are part of the Campaign. A POST call sends visitor behavior data by populating those Metrics. A POST has a response BODY similar to a GET, and returns the state of Campaigns.

Note: For domains that are routing through SiteSpect, Metrics in an Engine API Campaign are populated in the usual manner, meaning through regular HTTP requests. In this scenario, you might not need a POST visit data call.

In a typical scenario, you want to make a GET request when the session starts and make the POST call whenever any Metrics are triggered. You can pass visitor behavior with Metrics at any time; in addition, you can pass multiple Metrics in one call. Each Metric must include hits data (how many times the behavior occurred) and optionally, Metrics can include a Value Capture, for example, an average order amount.

These Metrics are stored within the context of a visit based on the setting for User Session Timeout on the User Tracking page (ManageConfigurationSite SettingsUser Tracking). Each GET or POST call extends session timeout. In addition, the Maximum Visits Expiration and Previous Visit Time Expiration settings at the Campaign level affect how visits are processed. You can find both on the Time & Duration tab of the Campaign.

Note: Client-side request to Engine API endpoints include CORS (Cross-Origin Resource Sharing) headers by default.