Treasure Data users can use data from a tracking pixel to send events to Treasure Data.

Prerequisites

  • Basic knowledge of Treasure Data


Treasure Data recommends that you implement any new features or functionality at your site using the Treasure Data JavaScript SDK version 3 Beta. It manages cookies differently. Be aware when referring to most of these articles that you need to define the suggested event collectors and Treasure Data JavaScript SDK version 3 calls in your solutions.

For example, change //cdn.treasuredata.com/sdk/2.5/td.min.js to //cdn.treasuredata.com/sdk/3.0.0-beta/td.min.js.

Preparing the URL

You must set up authentication and specify a path before you can add the postback that is used by Treasure Data.

Authentication

Every request must contain authentication information, provided by the special td_write_key URL parameter. The API key can be retrieved from TD Console. It’s recommended to use write-only API key.

https://in.treasuredata.com/postback/v3/event/{database}/{table}?td_format=pixel&td_write_key=XXXYYYZZZZ&...

Parameters

Specify these two parameters within a path.

  • {database}: specify the destination database name in the URL. Only alphabet, numbers, or _ are allowed.

  • {table}: specify destination table name in URL. only alphabet, numbers, or _ are allowed.

Any URL parameter, except special parameters listed as follows, is considered as a column inside the record.

  • td_format: Specify pixel

  • td_write_key: As described in Authentication.

  • td_record_time: Specify a UNIX timestamp value to set time column in Treasure Data. If it’s not specified, the time records that are received are used.

  • td_global_id: If td_global_id=td_global_id in the query string of postback URL is added, then the API adds a column named td_global_id with value of actual td_global_id into the record.

  • td_ip: If td_ip=td_ip in the query string of postback URL is added, then the API adds a column named td_ip with the value of source IP into the record.

  • td_ua: If td_ua=td_ua in the query string of postback URL is added, then the API adds a column named td_ua with the value of actual user-agent into the record.

  • td_redirect: The API can redirect to the specified URL. The URL must be encoded. If the td_redirect value includes td_global_id as a parameter, then the API replaces it with an actual value.

All parameter values are considered as strings, and you cannot change the value type at the ingestion time with a tracking pixel.

For example URL structure would be something like this:

https://in.treasuredata.com/postback/v3/event/{database}/{table}
  ?td_format=pixel
  &td_write_key=XXXYYYZZZZ
  &td_global_id=td_global_id
  &td_ip=td_ip
  &td_ua=td_ua
  &your_custom_key1=val1
  &your_custom_key2=val2
  &your_custom_key3=val3...

Use with <img> Tag

Use the URL with an img HTML tag as the postback to Treasure Data.

<img src="https://in.treasuredata.com/postback/v3/event/{database}/{table}?td_format=pixel&td_write_key=XXXYYYZZZZ&td_global_id=td_global_id&td_ip=td_ip&td_ua=td_ua&key1=val1&key2=val2&key3=val3..." />
  • No labels