Set Up Pixel for Link Tracking & Purchase Orders

The Sales Attribution Tracking Pixel is a way for your brand to track link attribution and purchase orders/discount code use as people visit your eCommerce store.  For every ambassador that shares their unique links and/or discount codes, you will be able to track the number of sales that were referred per person.

Overview

To set up sales attribution tracking, please complete the following steps:

  • Generate a "Sales Attribution" access token to be included in your JavaScript code.  Go to your brand settings to create a new token.
  • Embed the link tracking JavaScript code on every page of your site.
  • Send order data upon purchase.

Step 1. Add The Link Tracking Pixel

To add the tracking pixel to your store you'll need to add the following JavaScript snippet on every page of your site so the Wooly system can capture referred visits.  Embed this just before  </body> tag in your HTML. (this is typically done in the main site template so it's auto-magically applied to every page)

<!-- Wooly Analytics: START -->
<script async type="application/javascript" src="https://saa.wooly.com/wooly-analytics.js?token={ACCESS_TOKEN}"></script>
<!-- Wooly Analytics: END -->

Note: be sure to replace the {ACCESS_TOKEN} placeholder with your token.

Step 2. Integrate Order Tracking (advanced)

Send specific order data to us so we can capture the order data and, optionally, the new customer's information.  Sending Wooly the customer information is valuable in forming an attribution data graph of who referred who.  Wooly also links social listening and campaign participation data to customers along with other useful information that can all tie back to how the customer first joined your herd.

Option 1: JavaScript Code

Add the following JavaScript code on your order confirmation page and replace the placeholders with variables/properties in your code.  The minimum required parameter to capture an order is the orderId. Be sure you don't forget that one!  All other fields are optional, but the more you send us the more valuable your data is in the Wooly CRM and analytics.  For more details see our API Documentation. It's important to note that the root link tracker will automatically include the referral data so you don't need to do that here.

This first example is a preferred option by many developers:

<!-- Wooly Order Submission: START -->
<script type="application/javascript">
	WoolyAnalytics.set({
		firstName: "John",
		lastName: "Doe",
		email: "johndoe@email.com",
		orderId: "123456",
		discountCodes: ["sale2020", "janedoe123"],
		currency: "USD",
		totalPrice: 29.99
	});

	WoolyAnalytics.emit();
</script>
<!-- Wooly Order Submission: END -->

Another option is to set each property value individually as shown in this example:

<!-- Wooly Order Submission: START -->
<script type="application/javascript">
	WoolyAnalytics.set({firstName: "John"});
	WoolyAnalytics.set({lastName: "Doe"});
	WoolyAnalytics.set({email: "johndoe@email.com"});
	WoolyAnalytics.set({orderId: "123456"});
	WoolyAnalytics.set({discountCodes: ["sale2020", "janedoe123"]});
	WoolyAnalytics.set({currency: "USD", totalPrice: 29.99});

	WoolyAnalytics.emit();
</script>
<!-- Wooly Order Submission: END -->

Option 2: Webhook

Some eCommerce platforms have the ability to customize webhooks when orders are completed. With the right flexibility, it's possible to utilize webhooks to send the order data to one of our Sales Attribution API endpoints.

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