Wix Manual Tracking Setup

Master Tag Installation

In order to get started on ShareASale with Wix, turn on Dev Mode in Website Editor as shown below.

A panel will open on the left side of the screen that lists the pages of your site. Underneath this list will be a page labeled ‘masterPage.js’. Select that option.

 

At the bottom of the screen, a panel will open with a tab labeled ‘masterPage.js’. Select that tab. Underneath that tab, in the code editor, replace the existing code with the code below.

import {session} from 'wix-storage'; import wixLocation from 'wix-location'; $w.onReady(function () { var sasId = wixLocation.query; if (sasId.sscid) { session.clear(); session.setItem('sasId', sasId.sscid); } });

The result will look like this:

Click Publish at the top-right of your screen.

Conversion Tracking Pixel Installation

Next, go to your store’s Thank You page, or whichever page is reached after an order has been successfully processed. Add an new image to the page. The image can be of anything, and you can place it anywhere on the page. Do not use an image that is already on the page. Right-click the picture that you just placed and go to Show Properties & Events. It will be the last option in the list.

Show Properties & Events - Highlighted In Red

Once selected, the properties menu will appear in the bottom right corner of the screen. Set the ID to sasImage. Then, check the box next to Hidden under Default Values

Click on the Thank You Page option in the left panel of the page. In the code panel at the bottom of the screen, make sure that the Thank You Page tab is opened. You will enter the following code in the panel at the bottom.

Make sure that you replace the XXXXX in the code below with your ShareASale Merchant ID (line 2). You can find this at the top-left of your ShareASale account when you are logged in.

import {session} from 'wix-storage'; const merchantID = 'XXXXXX'; const sasToday = new Date(); $w.onReady(function () { $w('#thankYouPage1').getOrder() .then(async result => { const orderDate = new Date(result._dateCreated); var sas_skulist = new Array(), sas_pricelist = new Array(), sas_quantitylist = new Array(), sas_clickID = session.getItem('sasId'), sas_coupon = (result.discount && result.discount.appliedCoupon) ? result.discount.appliedCoupon.code : "", sas_amount = result.totals.subtotal - result.totals.discount; for (var i = 0; i < result.lineItems.length; i++) { sas_skulist.push(result.lineItems[i].sku); sas_pricelist.push(result.lineItems[i].priceData.price - result.lineItems[i].discount); sas_quantitylist.push(result.lineItems[i].quantity); } const sasPixel = 'https://www.shareasale.com/sale.cfm?v=wix1.1&tracking=' + result.number + '&amount=' + sas_amount + '&merchantID=' + merchantID + '&currency=' + result.currency + '&transtype=sale&skulist=' + sas_skulist + "&pricelist=" + sas_pricelist + "&quantitylist=" + sas_quantitylist + "&couponcode=" + sas_coupon + "&sscid=" + sas_clickID + "&sscidmode=6";; if (Math.abs(sasToday - orderDate) < 86400000) { $w('#sasImage').src = sasPixel; } else { console.log("Order older than 1 day. ShareASale Pixel Suppressed: " + sasPixel) } }); });

It should resemble the following:

 

IMPORTANT! Sometimes your Thank You page code might throw up an error if you have custom or multiple Thank You pages. You will see a RED circle next to the line number (usually line 7), and when you hover over this it will say “'#thankYouPage1' is not a valid selector”.

If this is not the case for you, please skip the next step and proceed to testing. If you do get the error above, look just below the header section of your page. There should be a blue line separating the header content from the body content. You should see a # symbol followed by the page’s ID like in the image below.

In the example above, we can see that the page selector is #confirmationPage. To fix the error, find #thankYouPage1 and replace it with identifier as found in the above example. So for the example, $w('#thankYouPage1').getOrder() becomes $w('#confirmationPage').getOrder().

Click Publish at the top right.

Now that your tracking tags have been installed, we will need to test that everything is working as expected. To do this, we’ll simulate an Affiliate referred purchase by clicking a ShareASale test link and then running a purchase on your store. If the test is successful we’ll see a record appear in your ShareASale console, which we will VOID so that it doesn’t debit commissions from your account.

If you were emailed a link to this document, a test link may have been provided to you. If it wasn’t, you can obtain one from your account by clicking here.

NOTE: If you do not click the test link your order will not track.

The test link should direct you to your own store. Once there, please purchase any item in your store. Sometimes Merchants will have a test item worth $1.00 sale price, but above $0.00 minimum.

After the purchase is complete, navigate to www.shareasale.com in your browser and log into your account. Click Reports and then click Transaction Details from the drop-down menu.

Filter the report for Affiliate ID 178 using the panel on the left. The filtered view should now show your test purchase as an entry with today’s date.

If the order tracked successfully…

Your account is now ready to use ShareASale with your store. Please contact us at ShareASale@ShareASale.com for further information about:

  • Product specific commissions (offer different commissions by product)

  • New customer incentives (offer commission bonuses for new customers)

  • Exclusive coupon codes (used for tracking conversions without link clickthrough)

If the order does not show up in the Transaction Details Report…

Please verify that you have completed all of the steps as instructed. Common mistakes include not entering the correct Merchant ID in your tracking code and forgetting to click the test link.

If after verifying all of these steps your tracking still does not work please contact our support team at ShareASale@ShareASale.com.

Copyright ShareASale 2021