All Collections
Tracking scripts
Custom scripts
Introduction to custom scripts
Introduction to custom scripts
Christiaan Proper avatar
Written by Christiaan Proper
Updated over a week ago

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}}" : "{{value1}}",
"{{field2}}" : "{{value2}}"
}]);
_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. Two examples:

_paq.push(["setCustomData", {
"opt-in": true
}]);
_paq.push(["trackPageView"]);
_paq.push(["setCustomData", {
"business": "b2b"
}]);
_paq.push(['trackPageView']);

Because it’s an overwrite, it isn’t possible to add data to a list (array/object). So if you want to add items to a list, you have to send over the total (expanded) list.

Did this answer your question?