Skip to content
Last updated

Profiles API Troubleshooting

You might encounter the following issue when you use Profiles API to:

Provide segment IDs to your tools. The tools can use the segments to provide personalized messaging or monitor and report activities.

This topic includes:

Make sure that the routing operation has been completed

When you use JS SDK endpoints below, using Real-time segmentation requires routing enablement from the Backend. Please reach out to Treasure Data Support and give us the account, database, and table to enable routing for, and we can do that from the backend. We will remove this limitation in the future release.

  • AP02 Region

    • ap02.records.in.treasuredata.com
  • Tokyo Region

    • ap01.records.in.treasuredata.com
  • US Region

    • us01.records.in.treasuredata.com
  • EU01 Region

    • eu01.records.in.treasuredata.com

Returning Segment IDs to Your Tool

There are a few reasons the API call cannot return segment IDs.

Limit the number of Segment IDs that can be returned

There is a 1KB limit to the number of segments ID the API can return. Segment IDs are returned by Profile API as an array. When you select segments as you configure a Profiles API, limit the number of segments.

Key Column Mismatch

The segments in the Profiles API setup must include profiles with values that match the Profile API specified key column. If no profiles match the API key column, then the API call does not return any segment IDs.

You can review profiles in a segment to ensure at least a few profiles have values that match the Profiles API key column.

Review the Profiles API Set Up

In the following profile setup, the key column is gender. For a segment ID to be returned by the API call, there must be records in the segment that have gender specified as an attribute and have a value (such as male or female).

The following example shows what the API call would look like:

https://cdp.in.treasuredata.com/cdp/lookup/collect/segments?version=2&token=<apiToken>&key.gender=female&callback=TreasureJSONPCallback1

Note the key.gender=female.

In the example, the API call is configured to find profiles in the specified segment where the gender is 'female' and is configured to retrieve the IDs of segments in which the profile is contained.

The configuration specifying female as the gender is in the Segment. The configuration that calls the Profiles API key to retrieve the segment ID is in the Javascript located in your web app or client.

Verify the Profiles API key column against the Segment attributes and Profile values

You can check your Segment to see if any profiles exist within a segment with the specified key column. You can view any profiles that return a value for the specified attribute.

In the following example, the gender value in the segment is set equal to 'Female.' The segment returns 16 profiles, which confirms that the API call can return some values to this segment and provide this segment ID if called to do so.

Make sure to send behavior data after configuring profiles API token and real-time segment

After you register the Profiles API token and real-time segment, we store some rule information in the backend to fetch behavior data from Profiles API.

Send behavior data from JS SDK after setting API token and real-time segment profiles.

Make sure to include a key column for behavior data sent from JS SDK

When you fetch data via Profiles API, please include the key column (specified in Profiles API token) in the data sent from JS SDK.

The key must exist in the SDK data; otherwise, Profiles API cannot fetch segments correctly.

When using td_global_id as the lookup key, the Profiles API will retrieve the lookup value from the browser cookie instead of the API request's query param. For testing or verification purposes outside of a browser (eg, Postman), use a different column to pass in the lookup value manually.