The Custom Data tag makes it possible to enrich the information collected by iAdvize by capturing additional data from visitor navigation, such as the product page ID, the category of the page viewed, or other custom criteria. Learn more...
1. Script to trigger on your site
<script>
window.iAdvizeInterface = window.iAdvizeInterface || [];
window.iAdvizeInterface.push(function(iAdvize) {
iAdvize.set('customData', {
product_id: "my-product-id",
page_type: "product-detail",
cust_email: "john.doe@provider.com"
});
});
</script>
⚠ This code must not be copy-pasted as is on your site.
The default values assigned to the variables are just examples. They must be dynamically replaced by your own data (in PHP / ASP / JavaScript, etc.).
⚠ In the parameters as well as in the integration of the JavaScript code, make sure to:
- Respect case sensitivity (uppercase/lowercase)
- Be aware that nested objects are not supported in custom data.
For example, you cannot do this:iAdvize.set('customData', { "my_obj" : { "field1": "toto" }});
You can also refer to our technical documentation.
2. When should this script be called or triggered?
This method of the iAdvize JavaScript WebSDK can be called as soon as you have new contextual information to send back to iAdvize.
Let’s imagine the following scenario:
-
Your visitor arrives on the homepage → you can trigger the code by sending only one custom data
"page_type"with the value"home-page". -
The visitor then navigates to a product page → you can trigger the code by sending both a custom data
"page_type"with the value"product-detail"and a custom data"product_id"containing the ID of the product currently displayed on this page. -
If your visitor logs into their account on your website, you can then trigger a new call to send back their ID and/or their email address via a custom data
"cust_email".