Table of Contents
Google Analytics: Adjusting for Canceled or Returned Orders
Problem: no way to remove transactions
Any ROI calculation shown in your Google Analytics reports becomes misleading unless returned and canceled orders are taken into account. Unfortunately Google Analytics at this time does not offer a robust set of feature to take into account canceled or returned orders. The only information provided by Google is contained in the following article.
Solution: posting "negative" transactions
We have taken the information in the article mentioned above and created a tool in the ProductCart Control Panel that allows you to post a negative transaction to Google Analytics, as this article suggests.
It's important to understand that the negative transaction will only be applied from the date it is submitted, and not from the date the order was originally placed. So if an order is placed on the 1st of the month and is then returned on the 15th, the negative transaction will likely be posted to Google Analytics on that day. That means that sales reports for the first two weeks (1st through the 14th) will be incorrect.
Unfortunately there is no workaround for this problem.
Add tracking code to the refund file
You need to make a small code change to one of the Google Analytics files to use this feature.
- In the Google Analytics files that you have downloaded, browse to the pcadmin folder for the version that you are using
- Locate the file pcGA_refundSubmit.asp
- Locate the area of the code (after line 30) where the Google Analytics tracking code should be saved
- Replace the existing code with yours, which is the tracking code mentioned here.
- Save the file and upload it to the pcadmin folder (which has likely been renamed on your store).
How to post a refund or cancellation
Adding a link to the Control Panel navigation
In the Control Panel, navigate to the page pcGA_refund.asp. If you want to, you can add a link to this page by editing the Control Panel navigation links.
- Download the file pcv4_navigation_links.asp from the Control Panel folder and make a backup copy of it
- Open it with your favorite HTML editor or Notepad
- Locate the unordered list that starts with:
<li class="firstLevel"><a class="MenuBarItemSubmenu" href="#">Orders</a> <ul>
- Add the following item to the list, between the <ul> and </ul> tags:
<li><a href="pcGA_refund.asp">Google Analytics: post refunds</a></li>
- Save the file and upload it back to the Control Panel folder
How to post a refund/cancellation
Log into the Control Panel and use the new link you added to the navigation by selecting Orders > Google Analytics: post refunds
- Select an order from the list or enter the order number and click on the Start button.
- On the following page you can specify what information will be posted to Google Analytics
- For full return or cancellation, you can leave everything “as is” (i.e. all items are included in the transaction posted to Google Analytics).
- For a partial refund, edit the transaction amount to reflect the amount that is being credited back to the customer. For example, if the original order was $100 and the customer returned products worth $20, you would enter ”-20” in the amount field. You can also specify the taxes and shipping charges (these amounts are included in the Order Total, but can be also separately listed to have additional information in the reports).
- In the section of the page that lists the items that had been purchased, you can specify the quantity for each of the items that are being returned. If an item is not being returned, enter 0 in the quantity field. That item will be excluded from the transaction sent to Google Analytics. When not all items are returned, make sure that the transaction amount (Order Total) reflects the partial refund (or adjustment).
- When you are ready to post the transaction, click on Post Adjustments.
How your reports are affected
Note the following with regard to how your Web statistics are affected:
- The change is not instantaneous
You will not be able to see the adjustments in your Google Analytics report until the following day. After 24 hours or so, check your e-commerce reports and you should see the negative transaction appear on the day in which it was posted.
- The initial order is not adjusted
So depending on whether you create a report for a date range that includes or does not include the adjustment (the negative transaction), the sales figure will be different.
- Transactions may disappear
When two transactions offset each other (which is the case when you post a transaction for a full refund or cancellation), the transactions will not be shown in a report set up for a date range that includes both. That is, the report will not list the two transactions (e.g. one for $100 and one for -$100), but rather hide both. The same transactions are individually shown when a report is created a date range that includes one, but not the other.