ENGLISH
Search
⌃K

Passing Client Data Post-initialization

Some configurable attributes, where the attribute needs to be passed as an identifier (i.e. ID) associated with the customer, it’s possible that the information required is only known once the customer has logged to the brand website, which can happen after the chat is initialized.
In order to pass these attributes, a callback script should be run instead of the div function to collect this information after the Heyday chat has initialized.
There are two script options that allow for this to happen:

Track ID

The Track ID function should be used specifically to collect the Customer or Client ID of the user interacting with the chat.
<script>
window.hdAsyncInit = function() {
_hdt.heyday_track_id('ClientIdAfterInit');
}
</script>
<script src='https://api.heyday.ai/v130/<organization>/<Channel>/fr/setupchat.js'></script>
ClientIdAfterInit: A Customer or Client ID usually in the form of an alpha-numeric value defined by the brand.
​

Track Customer

The Track Customer function allows for the chat to collect more information about the user interacting with the chat than just the Client ID. The other identifiable elements that can be collected are the client email address, as well as their first and last name.
<script>
window.hdAsyncInit = function() {
_hdt.heyday_track_customer({
id: "01234-abcdef-56789-ghijklm",
firstName: "John",
lastName: "Smith"
});
}
</script>
<script src='
https://api.heyday.ai/v130/<organization>/<Channel>/fr/setupchat.js'></script.
​
The elements collected using these scripts are displayed in the customer insights panel in the inbox. If collecting the Client ID, then the search function in the Heyday Inbox will return results for matching Client IDs
Important: if a ClientID was set with <div id="hdAttributes" external_id="ClientId"></div>, it will be overwritten by either of the two above scripts.
​