1

Since some of my logic is front end (page views) and some server side oriented (async events shot after user doing some things, not always "clicking" on something) I'm trying to combine reporting to Google analytics from front end and server side.

Frontend reporting utilizes React.GA and backend using Google Universal-analytics npm package.

Following the docs I'm using a custom userId, after setting a userId aware view and turning session merging on. In the frontend I set it as:

ReactGA.set({userId:uuid_id_custom_for_user});
ReactGA.pageview(pageViewPath);

And in the backend I report:

visitor = ua(analyticsId, userId, {strictCidFormat: false, uid:userId});
visitor.event(eventParamsObj, cb)

But still Google analytics shows me this error

A pageview hit must precede event hits in order for the event hits to include the page that they fire from. When event hits aren't preceded by a pageview, Google Analytics doesn't have the page for the event hits, so their page is (not set).

And all events are shown with page not set

Prior research: Similar questions such as this one are either obselete, or already reiterating steps I already did

Any clues on what am I missing? Thanks

alonisser
  • 11,542
  • 21
  • 85
  • 139
  • Could it be a simple timing issue? Can you test by delaying the backend call to see if that resolves it? – Matt Jun 23 '17 at 13:44
  • Sadly no.. The page view is almost always assured to be before. I would suspect a race condition if it happend "sometimes" – alonisser Jun 27 '17 at 19:17

0 Answers0