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 to 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 (sAttribution) {
sAttribution.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 = sAttribution.data.discountCodes;
var referralId = sAttribution.data.referralId;
if (referralId || (discountCodes && discountCodes.length)) {
sAttribution.emitOrder();
}
}
}
var saScript = document.createElement("script");
saScript.addEventListener("load", submitOrder);
saScript.src = "https://sa.getroster.com/sa.js?token=ACCESS_TOKEN";
document.body.appendChild(saScript);
</script>
<!-- Roster Order Submission: END -->