4

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?

user9993
  • 5,833
  • 11
  • 56
  • 117
  • 1
    "Unknown target" usually means you are sending pageviews to an uninitialized tracker, so first thing is you should check if you are sending something before the tracker is created (or you have a named tracker and try to send data to the default tracker). – Eike Pierstorff Jul 29 '15 at 10:40

1 Answers1

3

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.

Keegan
  • 179
  • 8