jimmy118
jimmy118

Reputation: 323

React pathways not working with google analytics

I have added a few google analytics to a react project for a client, but since doing so, I am no longer able to manually enter the route path in the address bar e.g "www.something.com/pathwayhere"

However, each link is woking correctly on the website if you click on the routes themselves.

I will try and remember everything I changed since the last time it was working correctly, but I strongly suspect it was one of the google analytic links which tracks the PageViews etc.

I have also added a facebook pix id, which is in connection with facebook businesses pages and advertising etc.

I have included my code for the route below;

<Route path="/personaltraining" component={PersonalTraining} exact/>

<Route path="/bodyTransformation" component={BoxingConditioning} exact/>

<Route path="/testimonials" component={Bootcamp} exact/> 

<Route path="/transformations" component={BodyTransformation} exact/> 

<Route path="/onlinetraining" component={OutdoorTraining} exact/>

<Route path="/homet" component={HomeTraining} exact/>

<Route path="/locations" component={Locations} exact/>   

<Route path="/admin" component={AdminPanel} exact/>  

<Route path="/menopause" component={OutdoorTraining} exact/>  

<Route path="/contact" component={Contact} exact/>          

<Route path="/blogging" component={Blogging} exact/> 

<Route path="/bookclass" component={Bookclass} exact/>                                     

<Route path="/parq" component={Parq} exact/>

<Route path="/burnitclass" component={BurnItClass} exact/>

<Route path="/bodytone" component={BodyTone} exact/>        

<Route path="/masterabs" component={MasterAbs} exact/>    

Your help is greatly appreciated.

Thanks!

Upvotes: 0

Views: 26

Answers (1)

Michele Pisani
Michele Pisani

Reputation: 14179

Most likely it depends on whether you are using a Google Analytics 4 Property ID (G-XXXXXXXX), while the React Analytics package in question works for Universal Analytics. I suggest you create a Universal Analytics Property (as shown in following image) and use the relative identifier UA-XXXXXXX-X:

enter image description here

Upvotes: 1

Related Questions