Passing Lists of Values with a Universal Pixel

Universal pixels accept variables as key-value pairs, but what if you want to pass through a list (for example, a list of SKUs from a customer’s order)? 

To pass a list of values for a single key, you can concatenate all the values together using a non-interfering separator (the pipe character here). Place the separator at the start and end:

<script>
var orderSkus = [41449, 28410, 1920];

var cntrData = {
     'event': 'orderCompleted',
     'skus': '|' + orderSkus.join('|') + '|',
     'cntr_revenue': 39.52
};
</script>

<!-- Universal Pixel Script Goes Here -->

This sends the string ‘|41449|28410|1920|’ to the skus key.

You can then use it like this in a rule set:

universal_pixel_skus_example.png

Because the first rule uses the contains operator, it will match if any of the SKUs in the list match. 

 

Was this article helpful?
0 out of 0 found this helpful