The Targeting API is used for personalising websites in realtime. Personalisation happens from the moment the visitor arrives at the website.
The Targeting API is a REST Service which can be integrated into the Content Management System or Shop Systems.
With the help of the transferred data, website content can be generated dynamically or exchanged depending on the interest of the customers. In this way, the etracker Targeting API does not just help to improve the user experience, but also to increase the conversion rate and turnover.
Access to the TAPI
The following requirements need to be satisfied in order to be able to use the etracker Targeting API:
- Desired targeting data must be recorded by etracker and transferred via events (using eCommerce API) or order parameters when calling the page. Orders, product performance events (‘Product viewed’, ‘Product placed in basket’ and/or ‘Product ordered’).
- The desired targeting data (attributes) are configured by etracker.
In order to call the interface, send a request to the URI of the Targeting API. You can call the interface in the frontend using JavaScript or in the backend via HTTPS. One query is enough per session (at the start of the session).
- The request for the interface must contain two parameters:
et
transfers the account key 2 which you can find in the etracker application under Settings → Setup/Tracking Code. Account Key 2 is Base64-encoded. - _et_coid
transfers the first-party cookie from the domain of the etracker customer.
Note:
You can also determine the _et_coid using JavaScript.
For testing purposes you can use the cookie ID _et_coid using Firebug from the website.
https://ws.etracker.com/api/v6/realtime/user?et=<account-key>&_et_coid=<CookieId>
Example:
https://ws.etracker.com/api/v6/realtime/user?et=YM9dM9&_et_coid=6bbece51587a6f7aac4989953149ca47
Response
Note:
When a visitor visits a website for the first time, for technical reasons it can take up to half an hour until the Targeting API provides a new user profile.
Response Structure
The interface provides user profile data in its response. The response is provided in JSON format and in table form with n columns for the attribute name (header) and n lines for the attribute values (data). The number of lines depends on the size of the user profile. The JSON response structure looks as follows:
{ “status”: “success”,”,”version“:2, “header”: [ ... ], “data”: [ ... ] }
Example with standard attributes:
{ “status”:“success”,“version”:2, “header”:[ “avg_order_value_seg”, “customer_type”, “device_type”, “device_type_detail”, “frequency_seg”, “is_newsletter_recipient”, “purchaser_type”, “time_since_last_order_seg”, “visit_count_seg”, “visitor_type” ], “data”:[ “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_01”, “STC_CC_ATTR_VALUE_CUSTOMER_TYPE_2”, “STR_CC_ATTR_VALUE_DEVICE_TYPE_DESKTOP”, “STR_CC_ATTR_VALUE_DEVICE_TYPE_DESKTOP”, “STC_CC_ATTR_VALUE_FREQUENCY_SEG_02”, “STC_CC_ATTR_VALUE_NEWSLETTER_2”, “STC_CC_ATTR_VALUE_PURCHASER_TYPE_1”, “STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_01”, “STC_CC_ATTR_VALUE_VISIT_COUNT_SEG_04”, “STC_CC_ATTR_VALUE_VISITOR_TYPE_1” ] }
Response Attributes
The user profile data is provided via the configured attributes. etracker configures the attributes when purchasing the product according to the needs of the customer. At the moment, a maximum of ten attributes are permitted.
Note: There are currently ten standard attributes which are also evaluated in the Testing & Targeting Reports.
etracker provides the following attributes:
General Attributes
Attribute | Frequency of visits |
---|---|
Attribute name | visit_count_seg |
Description | Standard attribute with categories for the number of previous visits. |
Data type | String |
Attribute values (example) | ″STC_CC_ATTR_VALUE_VISIT_COUNT_SEG_01″ (just one visit) (default value) ″STC_CC_ATTR_VALUE_VISIT_COUNT_SEG_02″ (low = 2 visits) ″STC_CC_ATTR_VALUE_VISIT_COUNT_SEG_03″ (medium = 3-4 visits) ″STC_CC_ATTR_VALUE_VISIT_COUNT_SEG_04″ (high = 5 and more visits) |
In order to evaluate the following attributes, the UserAgent needs to be transferred to the TAPI by the client request using the http header ‘User-Agent’. Example transfer of client user agent User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Attribute | Browser |
---|---|
Attribute name | device_browser |
Description | Name of the browser from which the visitor in the current session accessed the website. |
Data type | String |
Attribute values (example) | ″Firefox″ |
Attribute | Browser version |
---|---|
Attribute name | device_browser_version |
Description | Version of the browser from which the visitor in the current session accessed the website. |
Data type | String |
Attribute values (example) | ″37″ |
Attribute | manufacturer |
---|---|
Attribute name | device_manufacturer |
Description | Manufacturer of the device which accessed the website in the current session. |
Data type | String |
Attribute values (example) | ″Apple″ |
Attribute | Device name |
---|---|
Attribute name | device_model |
Description | Name of the device which accessed the website in the current session. Is only issued for mobile devices. |
Data type | String |
Attribute values (example) | ″iPad″ |
Attribute | Operating system |
---|---|
Attribute name | device_os |
Description | Operating system which accessed the website in the current session. |
Data type | String |
Attribute values (example) | ″Windows″ |
Attribute | Operating system version |
---|---|
Attribute name | device_os_version |
Description | Version of the operating system which accessed the website in the current session. |
Data type | String |
Attribute values (example) | ″7″ |
Attribute | Device type |
---|---|
Attribute name | device_type |
Description | Standard attribute describing the type of the device which accessed the website in the current session. |
Data type | String |
Attribute values | ″STR_CC_ATTR_VALUE_DEVICE_TYPE_DESKTOP″ (value for device_type = Desktop) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_MOBILE_PHONE″ (value for device_type = Mobile) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_TABLET″ (value for device_type = Tablet) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_OTHERS″ (value for device_type = Other) |
Attribute | Device type (Detail) |
---|---|
Attribute name | device_type_detail |
Description | Standard attribute which describes the device type in greater detail if possible. |
Data type | String |
Attribute values | ″STR_CC_ATTR_VALUE_DEVICE_TYPE_DETAIL_GAME_CONSOLE″ (value for device_type_detail = Game_Console) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_DETAIL_NON_SMARTPHONE″ (value for device_type_detail = Non-Smartphone) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_DETAIL_SMARTTV″ (value for device_type_detail = SmartTV) ″STR_CC_ATTR_VALUE_DEVICE_TYPE_DETAIL_SMARTPHONE″ (value for device_type_detail = Smartphone) |
Geo Attributes
The Targeting API (TAPI) offers the option to use the location of website visitor without the localisation API of the browser. Tracing back to the Internet provider is possible using a GeoIP resolver service. The TAPI provides information on the location of the visitor in regard to country, state and city. In order to evaluate the following attributes, the Client IP needs to be transferred to the TAPI by the client request using the http header ‘X-Forwarded-For’. Example transfer of Client IP X-Forwarded-For: 31.19.38.145
Attribute | Country |
---|---|
Attribute name | geolocation_country |
Description | Country from which the visitor in the current session accessed the website. |
Data type | String |
Attribute values (example) | Germany |
Attribute | Region |
---|---|
Attribute name | geolocation_state |
Description | Region from which the visitor in the current session accessed the website. |
Data type | String |
Attribute values (example) | Hamburg |
Attribute | City |
---|---|
Attribute name | geolocation_city |
Description | City from which the visitor in the current session accessed the website. |
Data type | String |
Attribute values (example) | Hamburg |
eCommerce Attributes
Note: In order to be able to use the eCommerce attributes, extended data collection must be integrated into the website to be measured. Only this way can events like, for example, ‘Product viewed’, ‘Product placed into basket’ or ‘Product ordered’ be transferred to etracker via the eCommerce API.
Profile information
Attribute | Customer ID |
---|---|
Attribute name | customer_id |
Description | Customer number, unique ID of a customer |
Data type | String |
Attribute values (example) | ″345565″ |
Attribute | Customer group |
---|---|
Attribute name | customer_group |
Description | Group to which a customer belongs, according to eCommerce API |
Data type | String |
Attribute values (example) | ″Regular customer″ |
Attribute | Purchaser type |
---|---|
Attribute name | purchaser_type |
Description | Standard attribute for categorising the purchaser according to the ABC analysis |
Data type | String |
Attribute values | ″STC_CC_ATTR_VALUE_PURCHASER_TYPE_1″ (no purchase) (default value) ″STC_CC_ATTR_VALUE_PURCHASER_TYPE_2″ (just one purchase) ″STC_CC_ATTR_VALUE_PURCHASER_TYPE_3″ (C = unimportant customer) ″STC_CC_ATTR_VALUE_PURCHASER_TYPE_4″ (B = important customer) ″STC_CC_ATTR_VALUE_PURCHASER_TYPE_5″ (A = very important customer) |
Attribute | Score Value |
---|---|
Attribute name | score_values |
Description | Score is a whole number which describes the relevance of the interest in a product. Transfer is done via an optional property ‘score’ in the product object of the eCommerce API. Example: You wish to present an offer to visitors who have already shown interest in a certain product. The offer should only be presented to those customers who have already shown interest to a specific degree in this product or product area. Interest can be illustrated by score values which are given on the visited product pages or product area pages. A visitor deemed to be interested in a product is someone who tallies up a score for a product over a certain period (e.g. in the last four weeks). |
Data type | Array with objects. Inside the objects there is the data type ‘String’ (JSON Property ‘‘product_name’’) and the data type ‘Number’ (JSON Properties ‘accumulated_value_last_7_days’, ‘accumulated_value_last_4_weeks’, ‘accumulated_value_last’ and ‘number_of_values’) |
Attribute values | [ { “White chocolate”: { “values”: [{ “accumulated_value”: 1000 }, { “accumulated_value_last_7_days”: 100 }, { “accumulated_value_last_4_weeks”: 900 }, { “accumulated_value_last”: 100 }], “number_of_values”: 3 } }, ... } ] |
Order information
Attribute | First Lead |
---|---|
Attribute name | lead_first_tm |
Description | Time of the first order (lead) |
Data type/Member | Millisecond timestamp detailing when the lead occurred |
Attribute values (example) | ″1400592736149400″ |
Attribute | First Sale |
---|---|
Attribute name | sale_first_tm |
Description | Time of the first purchase (sale) |
Data type/Member | Millisecond timestamp detailing when the sale occurred |
Attribute values (example) | ″1400592736149400″ |
Attribute | Last Lead |
---|---|
Attribute name | lead_last_tm |
Description | Time of the last order (lead). |
Data type/Member | Millisecond timestamp detailing when the lead occurred |
Attribute values (example) | ″1400592736149400″ |
Attribute | Last Sale |
---|---|
Attribute name | sale_last_tm |
Description | Time of the last purchase (sale) |
Data type/Member | Millisecond timestamp detailing when the sale occurred |
Attribute values (example) | ″1400592736149400″ |
Attribute | Time of the last order |
---|---|
Attribute name | time_since_last_order_segment |
Description | Standard attribute for categorisation according to time intervals between orders |
Data type | String |
Attribute values | ″STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_01″ (No order) (default value) ″STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_02″ (1-30 days) ″STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_03″ (31-90 days) ″STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_04″ (91 days - 12 months) ″STC_CC_ATTR_VALUE_TIME_SINCE_LAST_ORDER_SEG_05″ (more than 12 months) |
Attribute | Number of leads |
---|---|
Attribute name | lead_number_of_orders |
Description | Number of orders (leads) in a specific period |
Data type | Number |
Attribute values (example) | ″16″ |
Attribute | Number of sales |
---|---|
Attribute name | sale_number_of_orders |
Description | Number of purchases (sales) in a specific period |
Data type | Number |
Attribute values (example) | ″12″ |
Attribute | Sum of leads |
---|---|
Attribute name | lead_sum_order_price |
Description | Goods value of the order (lead) in EURO cents |
Data type | Number |
Attribute values (example) | ″120192″ |
Attribute | Summe Sale |
---|---|
Attribute name | sale_sum_order_price |
Description | Goods value of the purchase (sale) in EURO cents |
Data type | Number |
Attribute values (example) | ″100190″ |
Attribute | Time between leads |
---|---|
Attribute name | lead_avg_time_between_orders |
Description | Average interval between orders (leads) in milliseconds |
Data type | Number |
Attribute values (example) | ″120102″ |
Attribut | Time between sales |
---|---|
Attributname | sale_avg_time_between_orders |
Description | Average interval between purchases (sales) in milliseconds |
Data type | Number |
Attribute values (example) | ″16036865125″ |
Attribute | Product quantity lead |
---|---|
Attribute name | lead_total_number_of_articles |
Description | Total unit count of the order (lead) |
Data type | Number |
Attribute values (example) | ″40″ |
Attribute | Product quantity sale |
---|---|
Attribute name | sale_total_number_of_articles |
Description | Total unit count of the purchase (sale) |
Data type | Number |
Attribute values (example) | ″16″ |
Attribute | Average order value |
---|---|
Attribute name | avg_order_value_seg |
Description | Standard attribute which records the amount of average order values in EURO |
Data type | String |
Attribute values | “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_01” (0-10) (default value) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_02” (11-20) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_03” (21-40) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_04” (41-80) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_05” (81-100) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_06” (101-200) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_07” (201-400) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_08” (401-800) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_09” (801-1000) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_10” (1001-2000) “STC_CC_ATTR_VALUE_AVG_ORDER_VALUE_SEG_11” (2001-4000) |
Product information
Attributes of product categories | Top 10 product categories “Basket” Top 10 product categories “Bought” Top 10 product categories “Viewed” |
---|---|
Attribute name | basket_products_categories sale_bought_products_categories viewed_products_categories |
Description | Top 10 list of product categories which indicates from which product categories - most product were placed in the basket, - most products were bought, - most products were viewed. All lists are structured identically. The JSON property ‘rank’ indicates the position in the top 10, with “10” being the best. The timestamp shows when the last changes were made and the counter shows how often the product category was opened. |
Data type | Array with objects. Inside the objects there is the data type ‘String’ (JSON Property ‘category_name’) and the data type ‘Number’ (JSON Properties ‘timestamp’,’rank’ und ‘counter’) |
Attribute values (example) | [ … { "timestamp": "1416921576121300", "rank": "1", "category_name": "Others", "counter": "3" } , { "timestamp": "1416921576121300", "rank": "3", "category_name": "Geometric bodies", "counter": "9" } , { "timestamp": "1416921567909000", "rank": "2", "category_name": "foods", "counter": "2" } … ] |
Product attributes | Top 10 products “Basket” Top 10 products “Bought” Top 10 products “Viewed” |
---|---|
Attribute name | basket_products sale_bought_products viewed_products |
Description | Top 10 list of products shows which products - were placed in the basket the most often, - were bought the most often, - were viewed the most often. All lists are structured identically. The JSON property “rank” indicates the position in the top 10, with “10” being the best. The timestamp shows when the last changes were made and the counter shows how often the product was opened. |
Data type | Array with objects. Inside the objects there is the data type ‘String’ (JSON Properties ‘category_<0-3>‘) and ‘product_name’) and the data type ‘Number’ (JSON Properties ‘timestamp’,’rank’, ‘product_id’ and ‘counter’) |
Attribute values (example) | [ … { "timestamp": "1416921567909000", "rank": "2", "product_id": "6450", "category_3": "delicious", "category_1": "Sweets", "counter": "2", "product_name": "white chocolate", "category_2": "chocolaty", "category_0": "foods" } , { "timestamp": "1416921567909000", "rank": "1", "product_id": "6451", "category_3": "delicious", "category_1": "Sweets", "counter": "1", "product_name": "Dark chocolate", "category_2": "chocolaty", "category_0": "foods"} … ] (The product “white chocolate” with the ID “6450” has achieved the best positioning in regard to the considered attribute. For the “sale_bought_products” attribute, this would mean that white chocolate was sold more often than other products.) |
Engagement & Lead Attributes
Attribute | Time since last visit |
---|---|
Attribute name | frequency_seg |
Description | Standard attribute describing time intervals between visits |
Data type | String |
Attribute values | “STC_CC_ATTR_VALUE_FREQUENCY_SEG_01” (less than 1 day) (default value) “STC_CC_ATTR_VALUE_FREQUENCY_SEG _02” (1-7 days) “STC_CC_ATTR_VALUE_FREQUENCY_SEG _03” (8-30 days) “STC_CC_ATTR_VALUE_FREQUENCY_SEG _04” (More than 30 days) |
Attribute | First visit |
---|---|
Attribute name | engagement_lifetime |
Description | Time of the first visit |
Data type/Member | Millisecond timestamp detailing when the visit occurred |
Attribute values (example) | ″1404217686586200″ |
Attribute | Last visit |
---|---|
Attribute name | engagement_recency |
Description | Time of the last visit |
Data type/Member | Millisecond timestamp detailing when the visit occurred |
Attribute values (example) | ″1404480183492400″ |
Note: In order to be able to use the following top 10 list for areas or pages, the parameters for page names and areas in the parameter block of the tracking code must be transferred.
Attributes for favourites | Top 10 list for areas or pages |
---|---|
Attribute name | engagement_favorites_area, engagement_favorites_page |
Description | Top 10 list detailing which areas/pages were visited the most often. Every area/page has a timestamp and a rank of type Number. The timestamp shows when the last changes were made. |
Data type | Array with objects. Inside the objects is the data type ‘String’ (JSON Properties ‘page’ and ‘area’) and the data type ‘Number’ (JSON Properties ‘timestamp’ and ‘rank’) |
Attribute values (example of page favourites) | [ { “timestamp”: “1415627028457600”, “rank”: “1”, “page”: “dmexco” }, { “timestamp”: “1415713855503100”, “rank”: “3”, “page”: “Index” }, { “timestamp”: “1415713855436000”, “rank”: “2”, “page”: “Targeting Suite” } ] (The index page has the rank 3) |
Attribute | Newsletter subscriber |
---|---|
Attribute name | is_newsletter_recipient |
Description | Standard attribute which indicates if a visitor has registered for the newsletter. |
Data type | String |
Attribute values | “STC_CC_ATTR_VALUE_NEWSLETTER_1” (yes) “STC_CC_ATTR_VALUE_NEWSLETTER_2” (no) (default value) |
Status Attributes
Attribute | Repeat visitors |
---|---|
Attribute name | visitor_type |
Description | Standard attribute which indicates if a visitor is returning (or is new) |
Data type | String |
Attribute values | “STC_CC_ATTR_VALUE_VISITOR_TYPE_1” (yes) “STC_CC_ATTR_VALUE_VISITOR_TYPE_2” (no) (default value) |
Attribute | Customer |
---|---|
Attribute name | customer_type |
Description | Standard attribute which indicates if a visitor is a customer or not |
Data type | String |
Attribute values | “STC_CC_ATTR_VALUE_CUSTOMER_TYPE_1” (yes) “STC_CC_ATTR_VALUE_ CUSTOMER _TYPE_2” (no) (default value) |
Error Messages
Error Code | HTTP Status Code | Error Message | Error Message |
---|---|---|---|
3 | 504 | The request timed out. | Timeout des Requests |
4 | 403 | The access to the requested resource has been denied. | Access to resource denied |
5 | 500 | An internal server error occurred. | Internal server error |
10 | 400 | The secure code is missing (parameter et). | Secure code is missing |
11 | 400 | The passed secure code is invalid. | Secure code is invalid |
12 | 404 | Could not get a valid user mapping for the passed _et_coid cookie or _et_coid request parameter. | Targeting API not activated |
16 | 400 | The requested API version is not supported. | API version is not supported |
99 | 500 | An unexpected error ocurred. | Unexpected error |
Display of Smart Messages
On GitHub, etracker provides a jQuery plugin for viewing smart messages. The jquery.smartmessage plugin can be used to show how Exit-Intent, Attention Grabber or Greeter Messages can be implemented. The plugin queries the Targeting API for user profiles and uses etracker Analytics for tracking.