AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.5K members online now
4.5K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics on React JS site outputting incorrect data (broken sessions?)

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have a site with most of the content managed by Wordpress, however when the user navigates to search pages (user searches for a product), it's handled by React JS.

 

It's all on the same domain, so the user never knows that they are interfacing with two different applications.

 

Google Analytics on the site, however, doesn't seem to perceive sessions correctly. It's logging entrances (landing pages) to the site as search pages with rather long URLs:

xsoNz.jpg

 

  • There are thousands of landing pages like this, and the site is new, so there's no way this is all traffic is coming in from external links
  • Referrer path for all of these sessions is "(not set)"
  • Internal IP addresses are filtered
  • These problem landing pages/ sessions are not specific to any browser or device
  • The traffic is coming from various sources/mediums, suggesting that sessions are somehow breaking (screenshot below)ho5Kv.jpg

     

 

Currently, GA is set up with GTM.

I tried using this to fire the GTM tag in React.

 

Also tried making the GA tag within GTM fire on browser history changes rather than pageviews (history changes fire when in React, normal pageviews in Wordpress).

 

The issue still persists with these modifications. Anyone have any thoughts?

1 Expert replyverified_user

Google Analytics on React JS site outputting incorrect data (broken sessions?)

[ Edited ]
Top Contributor
# 2
Top Contributor

Is it only the search page urls that are being borked in the reporting?

1) Have any filters been added to the View in Google Analytics?
2) Has a default page been added to the View settings - immediately following the Time zone country or territory settings? A default page is often not necessary and can result in weird urls being returned in reports

 

eta.. im not familiar with React.js at all. Having said that, when i check the https://www.carjojo.com/search/ page, there is an error showing in GTA for GTM - <script> tag must not be included in a <div>
Also not sure if the following thread/info is helpful to you: 

Integration with react.js

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: Google Analytics on React JS site outputting incorrect data (broken sessions?)

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

No, it's all the URL's from the React JS application. /search.. /drilldown.. /cart.. are the paths, followed by a strong of URL variables.

 

I'll remove the <div> container, but that seems unlikely to be the cause. Firing on browser history changes as described in the Stack Overflow linked (in your link) is exactly what I've done. This is the recommended approach for SPA's who don't change the URL when new content is loaded.

 

There are filters on my main view, but the data is exactly the same as my backup view (which doesn't have any filters).

No default page set.

 

I'll check out the Medium article and see if that Redux implementation will work.