Google Universal Analytics - Command ignored

删除回忆录丶 提交于 2019-12-10 16:38:50

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/31697966/google-universal-analytics-command-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!