Getting a "Command ignored. Unknown target: undefined" with debugger plugin

30,495 views
Skip to first unread message

Bret Hansen

unread,
Jul 10, 2013, 2:25:15 AM7/10/13
to google-analyti...@googlegroups.com
I am getting no results when checking for Real-Time data.

I installed the Google Analytics Debugger plugin which, then causes my site to use analytics_debug.js. In the JavaScript console every ga('send', ...) results in this error in the console:

"Command ignored. Unknown target: undefined"

I can't find what the 'target' refers to. I have dung through what documentation there is on the newer analytics.js. I can't find an answer. analytics_debug.js is obfuscated by minimization, so it would be difficult to dig through to figure this out.

I believe I have followed all the steps. I have a valid tracker Id.

I am running this from a localhost delivered application. Shouldn't matter, but just in case :)

BTW if I use the ga('send', ... and pass in a 'hitCallback', the callback method gets called. Though docs sound like it will be called even if there was an error.

Can someone tell me what 'target' is? I would sure love to set it :)

Thx,
Bret

Brad Townsend

unread,
Jul 10, 2013, 1:55:48 PM7/10/13
to Bret Hansen, google-analyti...@googlegroups.com
Hi Bret,

Do you have a ga('create', 'UA-XXXX-Y'); command that preceeds the 'send' command?

-Brad



--
You received this message because you are subscribed to the Google Groups "google-analytics-analyticsjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-ana...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bret Hansen

unread,
Jul 11, 2013, 9:54:17 AM7/11/13
to google-analyti...@googlegroups.com, Bret Hansen
Yes I do call create first.

I did just stumble on the answer to my issue though.

I had used a ga('create', 'UA-XXXX-Y', {'name': 'myName'}) as documented @ https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference#create

This is the cause of the problem though! Even the example in the docs overview which shows using ga('create', 'UA-XXXX-Y') doesn't work.

You have to use the form shown when you sign up for a Tracking Id. It had to be:

ga('create', 'UA-XXXX-Y', 'www.mydomain.com')

However, it is not documented what this form of the call uses the 'www.mydomain.com' for. In fact, I can change the third argument to any arbitrary string and it works.

Bret

Bret Hansen

unread,
Jul 11, 2013, 9:56:55 AM7/11/13
to google-analyti...@googlegroups.com
I found a documentation issue, anyone know where I would report it to Google?

Brad Townsend

unread,
Jul 15, 2013, 10:28:13 AM7/15/13
to Bret Hansen, google-analyti...@googlegroups.com
Ah, I see the problem then. When you call 'create' with the name parameter, you are creating a named tracker object. Any commands you wish to issue to that tracker, including the 'require' command, must target that tracker explicitly by prefixing subsequent commands with the given tracker name. For example:

ga('create', 'UA-XXXX-Y', {'name': 'myName'});
ga('myName.require', 'linker');
ga('myName.send', 'pageview');

Usually, named trackers are only used in situations where there are multiple tracker objects on the same page and you need to target one individually. If you only need one tracker object, I suggest not specifying a name which will create the default tracker object. Any commands that do not have an explicit target are applied to the default tracker:

ga('create', 'UA-XXXX-Y');
ga('require', 'linker');
ga('send', 'pageview');

In your case, the ga('create', 'UA-XXXX-Y', 'www.mydomain.com') works because you are specifying a tracking id and cookie domain, but not a name. This creates a default tracker that is then able to receive the untargeted ga('require', 'linker') command.

It seems like the confusion is coming from the create method reference which provides an example named tracker but does not explain how this impacts the syntax of subsequent commands. I'll make sure this is updated with a link to our documentation explaining on Working with Multiple Tracker Objects or perhaps change the docs to not use this particular advanced feature as an example to begin with.

Thanks,
-Brad



On Thu, Jul 11, 2013 at 6:56 AM, Bret Hansen <brets...@gmail.com> wrote:
I found a documentation issue, anyone know where I would report it to Google?

--
Reply all
Reply to author
Forward
0 new messages