Visitor API reference (affinity groups)
Learn how to make a Visitor API request to retrieve a visitor's current affinity groups.
For more information about affinity groups, see Feature: Affinity group.
If you want to retrieve a visitor's affinity profile, see Visitor API reference (affinity profiles).
Requests
URL
The URL for Visitor API requests is https://<platform_instance>/visitorApi
, where <platform_instance>
is the domain name of your Frosmo Platform instance.
To get the URL for your Frosmo Platform instance:
-
In the header, click your username, and select API Access.
-
In the Visitor API section, copy the URL.
Authentication
The Visitor API does not require authentication.
Methods
The Visitor API supports the GET HTTP method for retrieving a visitor's current affinity groups.
Syntax
To retrieve a visitor's current affinity groups, make the following GET request:
GET https://<platform_instance>/visitorApi?method=affinityGroups&
origin=<site_origin>&
cookieId=<local_frosmo_id>
Parameters
Parameter | Description | Type | Role | Example |
---|---|---|---|---|
| Request type. Use the value | String | Required |
|
| Site origin. To find out your site's origin, see Getting your site origin. | String | Required |
|
| Frosmo ID of the visitor whose affinity groups you want to retrieve. To get the ID, see Getting a visitor's Frosmo ID. | String | Required |
|
| Login ID of the visitor whose affinity groups you want to retrieve. The ID allows the platform to get the visitor's affinity groups across multiple browsers. note For the login ID to work on a site, login support must be enabled for the site. To enable the feature, if it's not already enabled, contact Frosmo support. | String | Optional |
|
Request examples
GET https://inpref.com/visitorApi?method=affinityGroups&
origin=shop_company_com&
cookieId=dsr77t.kstzihlx
Responses
Success
On a success, the Visitor API returns the requested affinity groups in a JSON object. The response status code is 200
.
The response object contains the following root properties:
-
groups
: An array that lists the IDs of the affinity groups to which the visitor belongs. The affinity group IDs are prefixed withaffgp_
. -
user
: Object containing visitor information e.g. the visitor's decile or whether the visitor is in the comparison group.
{
"groups": [
"affgp_1096",
"affgp_1097",
"affgp_1098"
],
"user": {
"cookieId": "dsr77t.kstzihlx",
"loginId": "",
"decile": 8,
"isInComparisonGroup": false,
"source": "cookieId"
}
}
Error
On an error, the Visitor API returns the response status code 400
or 404
and an error message.
Error message | Description | Solution |
---|---|---|
| The affinity feature is not enabled for the site, meaning the Frosmo Platform does not track affinities for visitors of the site. | Have Frosmo enable the affinity feature for the site. Contact Frosmo support. |
| The affinity group feature is not enabled for the site, meaning the Frosmo Platform does not track affinity groups for visitors of the site. | Have Frosmo enable the affinity group feature for the site. Contact Frosmo support. |
| The | Provide the |
| The value of the | Provide a non-empty value for the |
| The value of the | Provide |
| The | Provide the |
| The value of the | Provide a non-empty value for the |
| The value of the | Provide a valid site origin as the value of the To find out your site's origin, see Getting your site origin. |
| The | Provide the |
| The value of the | Provide a non-empty value for the |
| The value of the | Provide a value that conforms to the following rules:
|
| The value of the | Provide a Frosmo ID that matches a visitor who belongs to at least one affinity group as the value of the |