Shopify Pixel - Reduced Data Push

First follow the instructions in the main Shopify pixel help article and then make the following changes to the order tracking script ensure order data is ONLY sent to Roster's servers IF a referral Id exists OR a discount code exists.

It's also important to note that the firstName, lastName & email fields are optional if you wish to exclude that data as well.


<!-- Roster Order Submission: START -->
<script type="application/javascript">
function submitOrder() {
if (WoolyAnalytics) {
WoolyAnalytics.set({
orderId: "{{ order.id }}",
discountCodes: [{% for discount in order.discount_applications %} "{{ discount.title }}", {% endfor %}],
currency: "{{ shop.currency }}",
subtotalPrice: {{ order.subtotal_price | money_without_currency }},
totalPrice: {{ order.total_price | money_without_currency }},
isNewCustomer: {{ order.orders_count <= 1 }}
firstName: "{{ order.customer.first_name }}",
lastName: "{{ order.customer.last_name }}",
email: "{{ order.email }}"
});

var discountCodes = WoolyAnalytics.data.discountCodes;
var linkTrackingCodes = WoolyAnalytics.data.linkTrackingCodes;

if ((discountCodes && discountCodes.length) || (linkTrackingCodes && linkTrackingCodes.length)) {
WoolyAnalytics.emit();
}
}
}

var saScript = document.createElement("script");
saScript.addEventListener("load", submitOrder);
saScript.src = "https://sa.getroster.com/wooly-analytics.js?token=ACCESS_TOKEN";
document.body.appendChild(saScript);
</script>
<!-- Roster Order Submission: END -->

Did this answer your question?