This article was created in versions prior to Google Analytics 4 (GA4) which is very different in how it approaches tracking data. We have a feature request for coding something new into AccessAlly to support GA4 users.
Contact support if you would like to be added as a +1 for this request.
If you’re using AccessAlly’s order forms, you can take advantage of the built-in Metrics dashboard… but you might also want to pull the sales data into your existing Google Analytics account.
In this tutorial we’ll take a look at how to use the Google Analytics Ecommerce tracking functionality in conjunction with AccessAlly.
Please note, this is an Advanced Tutorial and assumes you have some knowledge of Google Analytics, and are comfortable adding scripts to your website.
Enable Google Analytics Ecommerce Tracking
The first step is to enable Ecommerce tracking inside of your Google Analytics administration settings. This is an important step, because even if you do the next steps but you haven’t enabled Ecommerce, Google Analytics will not start tracking any data.
Once you click on the Ecommerce Settings, you’ll need to toggle the two Enable Ecommerce sections to “On”.
Add Tracking Parameters to Thank You Page Links
The next step is pass the details of your order through the thank you page link. This is something you’ll need to set up for every AccessAlly offer you put together.
You can use any type of thank you page link, as long as the link is on the site that has Google Analytics installed, and the tracking script set up (in the next step).
Your URL will require 4 arguments, two of which are pre-filled by AccessAlly already:
|orderId||Identifier for the order. Added by AccessAlly automatically.|
|price||Added by AccessAlly automatically.|
|item||Item id. Manually add to the URL – this can be the same as your AccessAlly product ID, or you might have another way of tracking products.|
|product_name||This is the name of your product. Manually add to the URL using + to replace spaces.|
Create a new page like this one: https://yourdomain.com/thank-you-popupally-pro/
Append parameters at the end of the thank you url (After the last ‘/’)
?item=[#item number]&product_name=[product name, replace spaces with +]
Here’s what a fully constructed URL might look like:
By filling in the item number and name of the product, you’ll end up with something like this inside of your Google Analytics ecommerce section:
This gives you a breakdown by product name. You’ll also be able to see the value of different pages across your site, thanks to this tracking.
Customize The Tracking Script
Now that you’re passing data through your thank you page, it’s time to add the script on your site that’s going to “catch that data” and pass it into your Google Analytics account.
You’ll want to copy and paste this code, and customize it to use your Google Analytics Tracking ID.
Important: You need to replace the two areas of the script that say UA-xxxxxxxx-yy with your own Google Analytics tracking ID.
Navigate to the Admin -> Property Settings.
Locate your unique Tracking ID, and replace the two spots in the script with UA-xxxxxxxx-yy to use your ID instead.
Adding The Script To Your WordPress Site
Now that the script contains your unique Google Analytics Tracking ID, and thank you page URLs are passing data, it’s time to add the script to your WordPress site.
The most important thing to remember is that you want to add the script to the same site where your thank you pages are located.
So if you’ve got a subdomain set up for your AccessAlly membership site, but you want to track ecommerce data back to your main website, you’ll want to put your thank you pages on your main website (or set up Google Analytics Cross Domain tracking, which is beyond the scope of this tutorial). In this case, you’ll add this script to your main website.
If your thank you pages are on your subdomain site, then add the script to your subdomain. (You could also add the script to both sites, so you’re covered if ever you have a thank you page going to both places for different products.)
Now let’s take a look at where to add the code. Under Appearance -> Customize.
Select “Code” and then “Header Code”.
Paste the code here and hit publish.
Run a test order
The best way to make sure that you’ve done the set up correctly is to run a test order. If you want to make sure that your URL and tracking script works first, you can also just visit the URL you created (just copy and paste into your browser).
Then remember that Google Analytics shows data up until the previous day by default, so you’ll need to edit the date range to include today to see if your test worked.
Ideally you’ll also test a full order (you can set up a 100% off coupon code for yourself) so you make sure that everything works end-to-end.
Congrats! I know this was a doozy, and it’s definitely not for the faint of heart. But having ecommerce data tracking inside of Google Analytics will help you see what traffic and marketing efforts are paying off.