setAttribute
Description
The setAttribute feature is a way to pass custom data into CartStack so it will be displayed within the report pages and included when exporting data.
Function Call
_cartstack.push(['setAttribute', { 'field name':'field value' }]);
Code Examples
This example includes the main CartStack tracking code and one setAttribute item.
<script data-siteid="XXXXXX" src="https://api.cartstack.com/js/customer-tracking/XXXXXXXXXX_222b5fb1025a6f580288f22cbd29c1bc.js" type="text/javascript"></script> <script type="text/javascript"> _cartstack.push(['setAttribute', { "OrderID":"1234567"}]); </script>
After you have set this up, you will be able to see the data in two places:
1) Report pages - you will be able to click the details button next to a record, which will show you a list of any custom attribute data. The below screenshot shows an example of two custom attributes (Product SKU and Product Category):
2) Export - also, when you export any reports you will see the custom attribute data as a new column in the CSV file. For example:
Please let us know if you have any questions!