- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
This document describes how to send data to the Customer Data Hub using the HTTP API for events. This article provides the specification for the direct HTTP endpoint, which can be used in any application that can send HTTP requests.
In this article:
Tealium Collect is an HTTP endpoint that supports GET and POST methods.
Tealium Collect is located at the following root URL:
https://collect.tealiumiq.com/event
Tealium Collect supports the following standard parameters in each request:
The format of the request will vary depending on the HTTP method used. In the examples below placeholder values are represented with curly braces in the following format: {VALUE}
.
Additional event attributes are sent as custom parameters according to your tracking needs. These parameters should also be defined as event attributes in the Customer Data Hub.
If you are using AudienceStream you must pass a known visitor identifier attribute (secondary ID) with each tracking call (e.g. email_address
or login_id
). If the events do not contain a visitor identifier each event will generate a new visit and visitor and stitching will not be possible. This is especially important if using the Collect API on a web platform where you might be tracking anonymous users.
A visitor identifier is also needed if you are using EventStream and need to provide an ID to a vendor connector.
Learn more about what makes a good visitor identifier in the Visitor ID Attribute article.
The tealium_visitor_id attribute is an anonymous identifier used by AudienceStream to associate a visitor between events and visits. This value should be a GUID (Globally Unique Identifier).
Depending on your usage of the Collect API, you can use one of the following approaches:
email_address
), include a concatenation of the account, profile and the known visitor ID attribute ID and value, and a SHA256 hash of that concatenated value in the tealium_visitor_id
parameter.AudienceStream | EventStream |
---|---|
Required | Recommended |
To use a hash of an email address for the primary Visitor ID, we recommend creating a unique hashed ID that includes the account, profile, and email address.
{ "tealium_account" : "my_account",
"tealium_profile" : "main",
"tealium_event" : "user_login", "email_address" : "user@example.com",
// SHA256 Hash of my_account_main_5102_user@example.com
"tealium_visitor_id" : "bad8145f125e0560d07872e77e98bc9cd8b7b763a4577adbbf52bfd7b164223e" }
tealium_visitor_id
will need to match the value in the utag_main_v_id
cookie. (Learn more about the built-in variables from utag.js.)AudienceStream | EventStream |
---|---|
Required | N/A |
The POST method 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.
Let's use the following "user_login" event for our examples:
{ "tealium_account" : "{ACCOUNT}",
"tealium_profile" : "{PROFILE}",
"tealium_event" : "user_login", "email_address" : "user@example.com" }
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
The GET method passes data using key/value pairs in the query string of the endpoint. This method 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"
Tealium Collect can be 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.
Example cache buster:
var cb=Math.random()*100000000000;
This variable would be 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 + '"/>
Tealium Collect supports cross-domain requests, so you can send a POST from your website to our domain. The Response Headers will include the following: Access-Control-Allow-Origin: http://your_domain.com
var event = {
"tealium_account" : "{ACCOUNT}",
"tealium_profile" : "{PROFILE}",
"tealium_event" : "user_login",
"email_address" : "user@example.com"
};
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://collect.tealiumiq.com/event");
xhr.send(JSON.stringify(event));
Copyright All Rights Reserved © 2008-2023