Tealium Setup
- Log into your Tealium Customer Data Hub server-side account.
Add a new Data Source
- Navigate to Sources > Data Sources located on the left menu bar.
- Click on the “Add Data Source” button.
- Under the “Developer Languages” category, select the “HTTP API”.
- Input a name for your new data source (e.g., “Cordial”) and click “Continue”.
- Click “Continue” once more to proceed to choose a Tealium Event Specification.
- You may select Event Specifications for your Cordial events or you may click the “Skip” button and create new custom event specs later.
Get Base Code
- As the last step, you should be presented with the base code where you may click “Download as PDF” located in the top-right corner.
Cordial Setup
- Log into your Cordial admin account.
- Navigate to Integrations > Webhooks located on the left menu bar.
- Click on the “New” button to add a new webhook.
- Enter a name (e.g. “Tealium HTTP API”) and click “Continue”.
- Click the “Edit” button and input the following as the webhook URL: https://collect.tealiumiq.com/event
Trigger Events
- Select the events you would like to stream to Tealium, and then click “Save”.
Webhook Payload
- Click the “Edit” button, and build your request payload for Tealium’s HTTP API endpoint using SMARTY syntax.
- Copy and paste the example code below. Make sure to change the values for tealium_account, tealium_profile, and tealium_datasource to match your Tealium account, profile, and data source key (refer to your base code PDF from the Tealium Setup instructions above):
{* A helper function to flatten a data object – DO NOT MODIFY *}
{function flatten data=[] next_key='' result=[]}{capture name="clearout"}{foreach $data as $key => $value}{if not empty($value)}{if is_array($value) and not isset($value[0])}{if $next_key}{$next_key = $next_key|cat:'.'}{/if}{$result = json_decode({flatten data=$value next_key=$next_key|cat:$key result=$result}, 1)}{else}{if $next_key}{$result[$next_key|cat:'.'|cat:$key] = $value}{else}{$result[$key] = $value}{/if}{/if}{/if}{/foreach}{/capture}{json_encode($result)}{/function}
{* Flatten the Cordial event data object *}
{$event = json_decode({flatten data=$event}, 1)}
{* 1. Tealium Parameters - Replace with your own settings *}
{* Required *}
{$payload['tealium_account'] = 'my-account'}
{$payload['tealium_profile'] = 'my-profile'}
{* Optional: HIGHLY Recommended *}
{$payload['tealium_datasource'] = 'abcdef'}
{$payload['tealium_event'] = 'cordial_'|cat:$event.action}
{* For Tealium debugging purposes *}
{* {$payload['tealium_trace_id'] = ''} *}
{* 2. Set up a mapping table - Cordial to Tealium *}
{$mapping = [
'a' => 'cordial_event',
'chnl' => 'cordial_channel',
'chnl-type' => 'cordial_channel_type',
'cID' => 'cordial_contact_id',
'msID' => 'cordial_message_id',
'mcID' => 'cordial_message_contact_id',
'ts' => 'cordial_timestamp',
'ats' => 'cordial_event_action_timestamp',
'tzo' => 'cordial_timezone_offset',
'sp.mTags' => 'cordial_message_tags',
'sp.ed' => 'cordial_email_domain'
]}
{* Start explicitly mapping over the data *}
{foreach $event as $key => $value}
{if not empty($value) and isset($mapping[$key])}
{$payload[$mapping[$key]] = $value}
{/if}
{/foreach}
{* 3. Optional: Append contact data here *}
{$payload['customer_email'] = $contact.channels.email.address}
{* Set the final payload for webhook *}
{$utils->setPayload($payload)}
Note: This example code has been tested for the email channel only. Please make adjustments as needed to work with other channels (e.g., SMS, Rest, Custom, etc.).
Customizing the Payload
The example SMARTY code provided in the previous step can be customized further to meet your Tealium taxonomy.
You can learn more about SMARTY syntax here: https://support.cordial.com/hc/en-us/articles/115005691407-Get-started-with-Smarty-syntax.
Testing
Using Live Events in Tealium
- Navigate to EventStream > Live Events located on the left menu bar.
- Select your new data source and click the “Apply” button:
- You should now be able to see incoming events from Cordial’s webhook while you are testing from Cordial’s platform. It will look something like this:
You can click on the recorded event to see more detail:
Sending a Test in Cordial
- Once you have successfully edited and saved your webhook payload, you will be able to use the “Test” button.
Click the “Test” button located on the left panel. - You will be presented with a “Send Test” modal. Search and select an event to test.
- Once you click on the event that you want to test, it will immediately trigger the webhook to Tealium.
If triggered successfully, you should have received a 200 OK response like the one below:
If you have any issues. Please reach out to your Cordial CSM or Cordial Support at support@cordial.com.
Comments
0 comments
Please sign in to leave a comment.