To send custom data to our tracking pixel, you need to make sure the project’s base pixel is present on the website. If you want to send custom data, you need to trigger this after the base pixel.
As any other JavaScript code, you need to make sure the code is between <script> tags.
The code you can use for adding custom data to a profile is:
_paq.push(["setCustomData", {
"FIELD1" : "value",
"FIELD2" : "value"
}]);
_paq.push(['trackPageView']);
You can send any data you want to our tracking script. These fields will overwrite if you send new data in a field. A few examples:
_paq.push(["setCustomData", {
"opt-in": true
}]);
_paq.push(["trackPageView"]);
_paq.push(["setCustomData", {
"setjourney" : 1234567890,
"setjourneyexpirationdays" : 7
}]);
_paq.push(['trackPageView']);
_paq.push(["setCustomData", {
"business": "b2b"
}]);
_paq.push(['trackPageView']);
_paq.push(["setCustomData", {
"firstname" : "<< first name here >>",
"lastname" : "<< last name here >>",
"email" : "<< email here >>"
}]);
_paq.push(['trackPageView']);
_paq.push(["setCustomData", {
"profilesource" : "Magento",
"profileid" : "<< profileid here >>"
}]);
_paq.push(['trackPageView']);