Shopify Instructions - Link Attribution Tracking

*Note: When following these steps be sure to begin by referencing the instructions outlined in this article about setting up the pixel.

Video Overview

Step 1. Add the Link Tracking Pixel

1. To add link tracking to your Shopify store in your admin portal navigate to Online Store > Themes > Edit code.

2. Open the "theme.liquid" file for editing the code.

3. Follow the instructions on Step 2 in the main article to embed the tracking pixel just before the </head> tag in your HTML.


Step 2. Integrate Order Tracking

1. Navigate to Settings > Checkout

2. Scroll down to the Order processing section and paste the following code into the Additional scripts box and be sure to replace the ACCESS_TOKEN placeholder with your sales attribution token you can get from your brand settings.

  • Note: this approach which includes the main tracking script is recommended because we've found that many Shopify store templates don't include the main website template which loads the top level tracking library.
<!-- Wooly Order Submission: START -->
{% if first_time_accessed %}
<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 }}",
        totalPrice: {{ order.total_price | money_without_currency }},
        firstName: "{{ order.customer.first_name }}",
        lastName: "{{ order.customer.last_name }}",
        email: "{{ order.email }}"
      });
      WoolyAnalytics.emit();
    }
  }
  let script = document.createElement("script");
  script.addEventListener("load", submitOrder);
  script.src = "https://saa.wooly.com/wooly-analytics.js?token=ACCESS_TOKEN";
  document.body.appendChild(script);
</script>
{% endif %}
<!-- Wooly Order Submission: END -->

Example result after you've copy/pasted the code into Shopify:


Testing

Reference Step 4 in the main article to make sure you have everything setup properly.


Congrats, You're Done!!  

You're all set up and your Shopify store is now able to track referral links and discount codes within Wooly.


Troubleshooting Tips

Some tests are failing? Go here for help with troubleshooting

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us