Endpoint Specification
This article provides the specification for the direct HTTP endpoint, which is used in any application that sends HTTP requests.
Tealium Collect URL
Tealium Collect is located at the following root URL:
https://collect.tealiumiq.com/event
Sessions are determined based on the Visit scope attribute property.
Visitor ID Attribute
If you are using Tealium AudienceStream you must pass a known visitor ID attribute (user identifier) with each tracking call, such as email_address
or login_id
.
If the events do not contain a visitor ID attribute then each event generates a new visit and visitor, making stitching not possible. This is important if using the Collect API on a web platform where you might be tracking anonymous users.
A visitor ID attribute is also needed if you are using Tealium EventStream and need to provide an ID to a vendor connector.
Learn more about the visitor ID attribute.
Anonymous ID
The tealium_visitor_id
attribute is an anonymous ID used by AudienceStream to associate a visitor between events and visits. Depending on your usage of the Collect API, use one of the following approaches:
Known Visitors
(Required for AudienceStream, recommended for EventStream)
When tracking events for a known visitor (when a value exists for a visitor ID attribute such as email_address
), include the known visitor ID attribute and a hash of that value in the tealium_visitor_id
parameter.
{
"tealium_account" : "ACCOUNT",
"tealium_profile" : "PROFILE",
"tealium_event" : "EVENT_NAME",
"email_address" : "EMAIL_ADDRESS",
"tealium_visitor_id" : "VISITOR_ID"
}
Anonymous Visitors
(Required for AudienceStream)
When tracking events for an anonymous visitor from a website (without a known ID), then the value of the tealium_visitor_id
needs to match the value in the utag_main_v_id
cookie.
Learn more about the built-in variables from utag.js
.
Methods
GET
The GET method is used to request data from a specified resource. It passes data using key-value pairs in the query string of the endpoint, and returns a 1x1 transparent GIF to make it compatible with HTML-based implementations.
Example using curl:
curl -i -X GET "https://collect.tealiumiq.com/event?tealium_account={ACCOUNT}&tealium_profile={PROFILE}&tealium_event=user_login&email_address=user@example.com"
POST
The POST method is used to send data to a server to create/update a resource. It supports JSON payloads where the request header must be set to Content-Type: application/json
and the payload must be formatted as a valid JSON string.
Example of user_login
event:
{
"tealium_account" : "ACCOUNT",
"tealium_profile" : "PROFILE",
"tealium_event" : "EVENT_NAME",
"email_address" : "EMAIL_ADDRESS"
}
Example using curl:
curl -X POST -H 'Content-type: application/json'
--data '{"tealium_account":"{ACCOUNT}","tealium_profile":"{PROFILE}","tealium_event":"user_login","email_address":"user@example.com"}'
https://collect.tealiumiq.com/event
Status Codes
The following table summarizes Tealium’s HTTP response status codes:
Status Code | Description |
---|---|
200 Status OK |
The request succeeded |
400 Bad Request |
The server does not understand the request |
The 400 Bad Request
status code occurs when at least of the following is true:
- The JSON key contains a period, is invalid, or exceeds 1MB in size
- The file-type parameter contains a value other than “json” or “javascript”
- The combination of
account
,profile
, anddatalayer_id
exceeds 250 characters in length, or contains restricted characters tealium_account
ortealium_profile
is missing, or contains typographical errors- The request body is empty
The following is an example of a 400 Bad Request
response, shown in the X-Error
header, when the required tealium_account
or tealium_profile
parameter values are missing:
> GET /event?tealium_account=jentest-as&tealium_profile=&tealium_visitor_id=sendgeteventhttps@testing.com&tealium_datasource=utc2cj&customer_city=Honolulu&customer_state=Hawaii&Flag=true&Number=45&String=ascent&String_Array=[hello,howareyou,whatsup,yoyoyo]&Number_Array=[2.222,3.000,19.12,28.3]&Flag_Array=[true,false,false,true]&Combo_Array=[1,salutations,2324,world,22jjfssl]&Array_of_Array=[[1,2,3],heyworld]&myvariable=unicorns HTTP/1.1
> Host: qa21-collect.tealiumiq.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Cache-Control: no-transform,private,no-cache,no-store,max-age=0,s-maxage=0
< Content-Type: application/json
< Date: Wed, 23 Oct 2019 17:10:51 GMT
< Expires: Wed, 23 Oct 2019 17:10:51 GMT
< P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID CUR ADM DEV OUR BUS"
< Pragma: no-cache
< Vary: Origin
< X-Error: Missing required tealium_account or tealium_profile param value
< X-Region: us-east-1
< X-ServerID: uconnect_i-9a157d19
< X-ULVer: 1.0.331-SNAPSHOT
< X-UUID: d4fc78d1-8204-412c-a6cb-57869d2370a7
< Content-Length: 0
< Connection: keep-alive
Examples
HTML Example
Tealium Collect is referenced in an <img>
tag within your HTML. Due to browser caching it’s important to include a cache buster, an additional parameter that contains a randomly generated value, as shown in the following example:
var cb=Math.random()*100000000000;
This variable is added to the query string of the Tealium Collect pixel:
<img height="1" width="1" style="display:none" src="//collect.tealiumiq.com/event?tealium_account={ACCOUNT}&tealium_profile={PROFILE}&tealium_event=user_login&email_address=user@example.com&cb=' + cb + '"/>
JavaScript Example
Tealium Collect supports cross-domain requests, allowing you to send a POST from your website to our domain, as shown in the following example:
var event = {
"tealium_account" : "ACCOUNT",
"tealium_profile" : "PROFILE",
"tealium_event" : "EVENT_NAME",
"email_address" : "EMAIL_ADDRESS"};
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://collect.tealiumiq.com/event");
xhr.send(JSON.stringify(event));
The Response Headers include the following:
Access-Control-Allow-Origin: [http://your_domain.com](http://your_domain.com)
Was this article helpful?
This page was last updated: January 6, 2022