Skip to the content


Google Analytics Duplicate Transactions in nopCommerce

Google Analytics Duplicate Transactions in nopCommerce

In the standard nopCommerce Google Analytics plugin , there can sometimes be a case where a user returns to a page, say a checkout completed page, and causes Google Analytics Transaction code to resubmit back to your Google Analytics reports. This issue causes Google Analytics to show you that you might have made more orders than you actually have, your number of sales and even your revenue figures may be effected.

This sort of issue can occur in the following scenarios:

  • Returning to the page via emailed link or bookmark.
  • Refreshing the page.
  • Navigating to a different page and returning via back button.
  • Page restoring from a closed browser session or on a smartphone.

Our Solution

We have come up with a solution to this. Our solution is to only fire the Google Analytics Tracking Code if the order has been created within 15 minutes of the users session. Google does not accept duplicate transactions that are within 20 minutes of that last transaction based on that order.

So if a user opens their browser an hour or so after they completed their order, the tracking code will now not be sent.


Here's the original code located in WidgetsGoogleAnalyticsController.cs:

																	if (controller.ToString().Equals("checkout", StringComparison.InvariantCultureIgnoreCase) &&     action.ToString().Equals("completed", StringComparison.InvariantCultureIgnoreCase))     {        var lastOrder = GetLastOrder();        globalScript += GetEcommerceScript(lastOrder);     }

And this is our solution code:

																	if (controller.ToString().Equals("checkout", StringComparison.InvariantCultureIgnoreCase) && action.ToString().Equals("completed", StringComparison.InvariantCultureIgnoreCase)) { var lastOrder = GetLastOrder();
																		//Only send the e-commerce tracking code if the order was placed within the last 15 minutes. //Google will de-duplicate transactions only if they are in the current session (20 minutes since last hit) if (lastOrder != null && lastOrder.CreatedOnUtc >= DateTime.UtcNow.AddMinutes(-15)) { globalScript += GetEcommerceScript(lastOrder); }


Google Analytics Enhanced e-Commerce Plugin

If you don't feel confident with editing code or are unable to, we offer this solution and many other cool tricks with our Google Analytics Enhanced e-Commerce plugin .

Here are just a couple of features that we include:

  • Easy installation and setup, just add your Google Analytics Property ID.
  • Supports tracking of product impressions wherever a product is shown. Including category, brand, and search pages, and in related products and cross sell lists.
  • Supports tracking add to basket events.
  • Supports tracking product detail click through events.
  • Supports tracking product detail page views.
  • Supports tracking of checkout initiation.
  • Supports tracking of completed transactions.
  • Enables full visualisation of shopping progression on the website.
  • Fully integrated nopCommerce Plugin.

Feel free to download a trial today and let us know how you get on!

You can also read the full documentation for the plugin here .

安博电竞 Consultants

安博电竞 Consultants are a team of experts in business management software. 

Partner with the Experts

With over 300 years of combined experience in Microsoft business solutions, our team will help to get you up and running, as well as building a partnership that keeps you supported, all from our UK offices. 

From functionality and licensing to business strategy, we like your questions; contact our experienced team for open, honest and reliable advice so that we can find the answers.

飞鱼电竞押注网站 28加拿大记录手机版数据 江湖电竞最新版比赛(江湖电竞投注app网站) 金沙电竞app pc加拿大28计划最稳胆码授权平台 街霸5(上海)查询APP v8.6