JavaScript Conversion Tracking for WooCommerce

WooCommerce is the most popular e-commerce plugin for WordPress. The conversion tracking code can either be hardcoded into your WordPress theme or installed using third-party plugins. In this article, you'll learn how to use plugins to install the conversion tracking code.

Note: did not develop the plugins suggested in this article, and cannot be held responsible for their use.


Install Conversion Tracking Plugins

1. Log into your WordPress admin account and go to Plugins > Add New.



2. Search for the “Header Footer Code Manager” plugin, click Install Now, and then click the Activate button that appears.



3. Search for the “WooCommerce Conversion Tracking” plugin, click Install Now, and then click the Activate button that appears.



Add Entry Page Code

1. In a new browser tab, log into your AdvertiserPro account and go to Settings > Conversion Tracking.



2. Click the Get JavaScript button.



3. Select your program and click Next.



4. Select the Entry Page Code and copy it.



5. In your WordPress account, go to the Plugins page, locate the Header Footer Code Manager plugin, and click Settings.



6. Click Add New Snippet.



7. Type in a Snippet Name and select the following settings. Snippet Type: JavaScript, Site Display: Site Wide, Location: Footer, Device Display: Show on All Devices, and Status: Active.­­­­ We suggest not excluding any pages or posts to avoid conversion tracking issues.



8. In the Snippet/Code section, paste the Entry Page Code that you copied from AdvertiserPro and click Save.



Add Confirmation Page Code

1. Go back to the Entry Page Code in AdvertiserPro and click Next.


2. Edit the variables at the top of the page to reflect the following. Order Amount: '{order_total}', Order Number: '{order_number}', Coupon: '{used_coupons}', Order Currency: '{currency}', and Geo: '{geo}'.

Notes: Be sure to include the quotation marks around each variable. Geo is not able to be tracked in this plugin.


3. Select the Confirmation Page Code and copy it.


4. In your WordPress account, go to the Plugins page, locate the WooCommerce Conversion Tracking plugin, and click Settings.



5. Locate the Custom section and click the toggle to activate it.



6. Paste the Confirmation Page code into the Successful Order field.



7. Select the “order_items” section of the code, delete it, and click Save Changes.

Create a Test Transaction

In your AdvertiserPro account, go to Settings > Tracking Diagnosis and follow the instructions to create a test transaction.

Note: Be sure to leave the Tracking Diagnosis page open while you create the test transaction and go back to that page to confirm that the test was successful.


Articles in this section