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 in a rule set where the first rule is

  • Rule Type: Key/String

  • Operator: Contains

  • Key: skus

  • Value: |41449|

and the second rule is

  • Rule Type: Key/String

  • Operator: Matches

  • Key: event

  • Value:orderCompleted

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

Previous
Previous

Universal Pixel Endpoint