user9993
user9993

Reputation: 6170

Google Universal Analytics - Command ignored

I'm using Google Universal Analytics to track page views. I can see when I navigate to the pages with the real time feature of the Google Analytics site, so my code must be working.

However Chrome keeps displaying this in the console:

Initializing Google Analytics   
    Running command: ga("set", "page", "/My Url here")
    Command ignored. Unknown target: undefined
    Running command: ga("send", "pageview")
    Command ignored. Unknown target: undefined

Shortly followed by the actual data to Google Analytics, which in combination with seeing my view in the Real Time panel, means that the data is successful being sent. So what is actually going on, if GA thinks the command is undefined, why is it still sending it?

Upvotes: 4

Views: 3916

Answers (1)

Keegan
Keegan

Reputation: 179

I would check that your GA initialization is being executed properly. Make sure that your UA# is inside a statement like so

ga('create', 'UA-XXXX-Y')

It looks like it is if your data is showing up on the real-time report.

Make sure that the code that you posted above is being run below the GA initialization code and the initialization code is at the end of the for GA and just after the if you're using GTM.

Upvotes: 3

Related Questions