Personalization and targeting work with the Engine API the same way they work for any other type of Campaign. You set them up the same way in SiteSpect; the client initiating the API call to SiteSpect can pass different URL parameters, headers, and cookies to limit which visitors are assigned to the Campaign. Other targeting options like seasonality, past visitor behavior, or custom data sets are also available.
Keep in mind that if the client is a web server (as opposed to a browser) the information passed in the API call (such as IP, user-agent, and so on) is not a group of parameters from the visitor but parameters from the web server. In this situation, it makes sense to pass visitor data in the HTTP request. You can do this in a traditional way, by passing custom headers/cookies in the request.
For convenience, you can also pass custom header/cookie overwrites in the body of the request (in JSON) and SiteSpect will use these. If any cookies or headers are passed in the body, the response also shows headers and cookies in the body.
The following is the JSON structure for passing HTTP Headers or Cookies inside the body:
{
"headers":{"header1":"header_value1","header2":"header_value2"},
"cookies":{"cookie1":"cookie_value1","cookie2":"cookie_value2"}
}
The following is an example of geo and device targeting by passing headers in body of GET request:
{
"headers":{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","True-Client-Ip":"X.X.X.X"}
}
Note: For IP to geo translation, SiteSpect looks at the following headers in order:
- 'True-Client-Ip'
- 'X-Forwarded-For'
- 'Client-Ip'
- 'Forwarded-For'
- 'CLIENTIP'