How can we help?

Stream event data to Tealium’s customer data hub in real time

Add new data source in Tealium

1. Log in to your Tealium Customer Data Hub server-side account.

2. Navigate to Sources > Data Sources located on the left menu bar.

3. Click Add Data Source

4. Under the Developer Languages category, select HTTP API.

5. Add a name for your new data source (e.g. Cordial) and click Continue.

6. Click Continue once more to proceed to choose a Tealium Event Specification.

7. You can select Event Specifications for your Cordial events or click the Skip button and create new custom event specs later.

8. As the last step, you'll be presented with the base code where you can click Download as PDF in the top-right corner. 

Cordial setup

Contact your CSM to enable Webhooks in your account.

1. Log in to your Cordial admin account.

2. Navigate to Integrations > Webhooks located on the left menu bar.

3. Click the New button to add a new Webhook.

4. Enter a name (e.g. Tealium HTTP API) and click Continue.

5. Click the Edit button and input the following as the Webhook URL: https://collect.tealiumiq.com/event

6. Select the events you would like to stream to Tealium and then click Save.

7. Click the Edit button, and build your request payload for Tealium’s HTTP API endpoint using SMARTY syntax.

8. 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)}

This example code has been tested for the email channel only. Please make adjustments as needed to work with other channels.

Customize the payload

The example Smarty code provided in the previous step can be customized further to meet your Tealium taxonomy.

Testing

Using live events in Tealium

1. Navigate to EventStream > Live Events located on the left menu bar.

2. Select your new data source and click the Apply button.

customer_data_hub_2.png

3. You should now be able to see incoming events from Cordial’s Webhook while you're testing from Cordial’s platform. It will look something like this:

customer_data_hub_3.png

4. You can click on the recorded event to see more detail. 

event_example_4.png

Send a test in Cordial

1. Once you've successfully edited and saved your Webhook payload, you'll be able to send a test.

2. Click the Test button in the left panel.

3. In the Send Test modal, search and select an event to test.

4. Once you click on the event that you want to test, it will immediately trigger the Webhook to Tealium.

5. 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.