This request can be used for authenticated feeding of DMP events to the processing system. Aggregation of the fed events can be done with /dmp/traffic, /dmp/traffic/event, /dmp/traffic/custom using DMP filters.
We recommend to use the DMP event helper function - sendEvent(..) when sending DMP events with a client-side approach (whenever it is possible). The function automatically sets the correct values for userIds, siteId, rnd and prnd.
The user must be authenticated and have write permissions to site groups/sites. The sites must be set up with a long-term and dmp capabilities.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Array of Object |
Yes |
An array of DMP events to feed. |
Each event object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Integer or String |
No |
Allows to specify the exact time of an event. Can be specified either as seconds measured in Unix time (e.g. 1400078399) or as ISO 8601 date and time in extended format (e.g., "2014-05-14T14:39:59.000Z"). The specified time must be less than 12 hours behind the current time, and not more than 60 seconds in future. If not specified, the time of event will be set to the current system time. |
|
|
Array of Object |
Yes |
List of known user identities to identify the user. Note that different users must be fed as different events. |
|
|
Integer |
No* |
A value uniquely identifying the corresponding page view event. In order to link DMP events to page views this value must be identical to the exported page view event . See the clarification below. |
|
|
Integer |
No* |
A value uniquely identifying this event. Multiple events on the same page view must have distinct /dmp/traffic/data . See the clarification below. |
|
|
String |
No* |
An alternative specification for pageViewEventId, meant to be used by the sendEvent(..) function or similar. In order to link DMP events to page views this value must be identical to the page view event . See the clarification below. |
|
|
String |
No* |
An alternative specification for eventId, meant to be used by the sendEvent(..) function or similar. Multiple events on the same page view must have distinct |
|
|
String |
Yes |
The analytics site identifier to be associated with the events. |
|
|
String |
Yes |
Differentiates various DMP applications used by the customer. Must be prefixed by the customer prefix e.g. |
|
|
String |
Yes |
Differentiates various event types, e.g., "click", "impression", "conversion", etc. |
|
|
Array of Object |
No |
An optional list of customer-defined parameters. Parameters fed with DMP events follow the same syntactical restrictions and limits as for ordinary custom-parameters for analytics events . |
|
|
Array of String |
No |
An optional list of consents, such as "required", "pv", "recs", "segment", "ad", "geo", "device" |
Syntactical Restrictions
-
STRING PARAMETERS: The maximum length of string parameters is 30 characters.
Event identifier clarification
-
While not mandatory, it is highly recommended to specify
eventId andpageViewEventIdeach event.pageViewEventIdis needed to distinguish between events corresponding to different page views, andeventIdis needed to distinguish between different events for a single page view. For correct linking with page views, thepageViewEventIdvalue must correspond to theeventIdvalue of the corresponding page view event. -
Generally speaking,
eventIdandpageViewEventIdshould be used when theeventIdvalue of the original page view event is available (e.g., importing new DMP event based on the previous results from /traffic/data and /dmp/traffic/data), whilerndandprndspecification should be used when therndvalue of the originating page view event is available (i.e., alongside sending a page view event from cx.js). -
Missing
eventId/rndwill result ineventIdbeing set to 0, missingpageViewEventId/prndwill result inpageViewEventIdbeing set to 0. If two events for the same user have the same eventId/rnd and pageViewEventId/prnd, then the two events will be considered as duplicates. Duplicate events is subject to de-duplication.
-
To be able to link DMP events against page view events,
userIds,pageViewEventId/prndandsiteIdof each event must match the values fed with the corresponding event id. -
Note also that
timeof fed events will be set to current server time. -
Custom parameters fed with DMP events follow the same restrictions as for ordinary custom-parameters for analytics events.
Each user identifier object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Site specific identifier (type cx) or external user identifier type. |
|
|
String |
Yes |
Value of the user identifier. |
For the custom parameter object, the following fields apply:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Parameter name, e.g., "campaign", "adspace" or "creative". The |
|
|
String |
No |
Parameter type, e.g. 'number' or 'string'. Use number for items to be used as DMP metrics , and string for items to be used in top-lists. |
|
|
String |
Yes |
Parameter value, e.g. '"sale"', '0.32', '42'. The format must agree with the specified type, i.e., use "42" for string and 42 for number. |
Response
The normal response is an empty object.
Examples
$ python cx.py /dmp/push '{
"events": [
{
"userIds": [
{
"type": "cxd",
"id": "123456"
}
],
"pageViewEventId": 12345,
"eventId": 12,
"siteId": "987654321",
"type": "impression",
"origin": "cxd-ads",
"customParameters": [
{
"group": "ad",
"item": "shoead5"
},
{
"group": "campaign",
"item": "shoesale"
},
{
"group": "creative",
"item": "fancyshoe"
},
{
"group": "adspace",
"item": "header"
}
],
"consent": ["pv", "recs"],
}
]
}'
{}
Pixel API
In some cases, we want to track performance data from tags or sites that do not run our CX.js script. We want to be able to do a pixel request towards our servers with URL parameters that are forwarded as a DMP event. One example could be tracking an impression from landing page of an advertiser that is not our customer, or a pixel tracker from an email newsletter.
This API will not require authentication of the client, but it will need to identify a persisted query.
Every request has to pass valid 'persisted' parameter.
All data is passed as URL query parameters. Values and keys are URL encoded.
Format of query string
/ : - reserved characters, cannot be used in key name neither parameter value
query_string: persisted=value(&debug=true)?(&key=value)*
value - URL encoded string
key - URL encoded string
key: primitive | object
primitive - string
object - object_name/field_1:value_1/field_2:value_2 ... /field_n=value_n
/ - field separator : - value separator object_name - string
field - string value - string
()? - means zero or one occurrence
()* - means zero or many occurrences
| - means 'or'
Below is presented translation of 'event' object into list of key value pairs and then into query string:
1. Event
{
"userIds": [
{
"type": "cxd",
"id": "123456"
}
],
"pageViewEventId": 12345,
"eventId": 12,
"siteId": "987654321",
"type": "impression",
"origin": "cxd-ads",
"customParameters": [
{
"group": "ad", "item": 15.5, "type": "number"
},
{
"group": "campaign", "item": "shoesale", "type": "string"
}
]
}
2. List of corresponding key=value pairs
pageViewEventId=1234
eventId=12
siteId=987654321
type=impression
origin=cxd-ads
userIds/type:cxd/id=123456
customParameters/group:ad/item:15.5/type=number
customParameters/group:campaign/item:shoesale/type=string
3. Final Query String
?persisted=nf4544&pageViewEventId=12345&eventId=12&siteId=987654321&type=impression&origin=cxd-ads
&userIds%2Ftype%3Acxd%2Fid=123456
&customParameters%2Fgroup%3Aad%2Fitem%3A15.5%2Ftype=number
&customParameters%2Fgroup%3Acampaign%2Fitem%3Ashoesale%2Ftype=string
HTTP GET Request format
-
/dmp/push.gif?query_string -
/dmp/push.html?query_string
https://comcluster.cxense.com/dmp/push.html?persisted=5555&pageViewEventId=12345&eventId=12&siteId=987654321&type=impression&origin=cxd-ads
&userIds%2Ftype%3Acxd%2Fid=123456
&customParameters%2Fgroup%3Aad%2Fitem%3A15.5%2Ftype=number
&customParameters%2Fgroup%3Acampaign%2Fitem%3Ashoesale%2Ftype=string
HTTP Response format
-
html (/dmp/push.html)
Example: <html />
-
1px gif (/dmp/push.gif)
Example: GIF89a����!�,D;
-
JSON (/dmp/push.html?debug=true or /dmp/push.gif?debug=true) if HTTP Status Code not 200
Example: HTTP Error 400: Bad Request {"error":"Invalid request: Invalid persisted request id"}