juha t
juha t

Reputation: 101

Google Analytics not receiving events (Command ignored. Unknown target: undefined)

So I got my Google Analytics set up via Google Tag Manager. Page views tracking is working fine. But when I try to track any events, the data is just not getting through to Analytics. The event tracking did not work with traditional Analytics code either.

Analytics debug is showing several "Create config had an unknown parameter: x" and "Command ignored. Unknown target: undefined"

Supposedly this means that there is something wrong with my tracker name. I have tried both default name and custom names.

Might be worth mentioning: Until recently, my site's default URL was wrong in Analytics site preferences, but I'm not sure if that has anything to do with this.

Analytics debug message:

Executing Google Analytics commands.
analytics_debug.js:10 Running command: ga("create", {2: null, 3: null, 6: "1", 10: false, 11: false, 12: false, 16: false, 17: false, 18: false, 28: false, 32: "UA-1439995-1", 33: false, 34: false, 35: [{fieldName: "cookieDomain", value: "auto"}]}, {name: "gtm5"})
analytics_debug.js:10 Creating new tracker: t0
analytics_debug.js:10 Create config had an unknown parameter: "2"
analytics_debug.js:10 Create config had an unknown parameter: "3"
analytics_debug.js:10 Create config had an unknown parameter: "6"
analytics_debug.js:10 Create config had an unknown parameter: "10"
analytics_debug.js:10 Create config had an unknown parameter: "11"
analytics_debug.js:10 Create config had an unknown parameter: "12"
analytics_debug.js:10 Create config had an unknown parameter: "16"
analytics_debug.js:10 Create config had an unknown parameter: "17"
analytics_debug.js:10 Create config had an unknown parameter: "18"
analytics_debug.js:10 Create config had an unknown parameter: "28"
analytics_debug.js:10 Create config had an unknown parameter: "32"
analytics_debug.js:10 Create config had an unknown parameter: "33"
analytics_debug.js:10 Create config had an unknown parameter: "34"
analytics_debug.js:10 Create config had an unknown parameter: "35"
Executing Google Analytics commands.
analytics_debug.js:10 Running command: ga("gtm5.set", "&gtm", "G32NJ6NK7K")
analytics_debug.js:10 Command ignored. Unknown target: undefined
analytics_debug.js:10 Executing Google Analytics commands.
analytics_debug.js:10 Running command: ga("gtm5.set", "nonInteraction", false)
analytics_debug.js:10 Command ignored. Unknown target: undefined
analytics_debug.js:10 Executing Google Analytics commands.
analytics_debug.js:10 Running command: ga("gtm5.set", "hitCallback", [function])
analytics_debug.js:10 Command ignored. Unknown target: undefined
analytics_debug.js:10 Executing Google Analytics commands.
analytics_debug.js:10 Running command: ga("gtm5.send", {hitType: "event", eventCategory: "contact-form", eventAction: "successful-form-submission-mailsent", eventLabel: "362", eventValue: undefined})
analytics_debug.js:10 Command ignored. Unknown target: undefined

Analytics debug message screenshot

Upvotes: 5

Views: 12003

Answers (4)

Simo Ahava
Simo Ahava

Reputation: 1446

The reason for this is that you have added a Google Analytics Settings variable into a field named “Tracking ID”, either in the tag itself or the settings variable used in the tag.

The field named “Tracking ID” can never have anything else except a string “UA-XXXX-Y” or a variable that returns said string (e.g. Constant, Lookup Table).

The Google Analytics Settings variable doesn’t return “UA-XXXXX-Y” but rather a configuration object. That’s why you see the errors.

Fix the Tracking ID field and your tag will work.

Upvotes: 0

user3015648
user3015648

Reputation: 31

I had this same problem. I had set my variable " tracking id" to type google analytics settings, instead of constant. Changing to constant removed this strange create function.

Upvotes: 3

juha t
juha t

Reputation: 101

I believe I have found a solution.

I edited my Universal Analytics tags (Contact Form Submission and GA-Pageview) in GTM by setting tracker names to blank.

(Edit Tag -> Enable overriding settings in this tag -> More Settings -> Advanced Configuration -> Set Tracker Name [True]

I have no idea why I had to do this and if this is a good solution. But now event tracking seems to work.

Upvotes: 5

Max
Max

Reputation: 13334

This is part of the answer: when you create your tracker initially, although you assign the name gtm5, the tracker is assigned the default name t0. Therefore when you refer to gtm5 in the later calls gtm5.set, it fails, and that's the error you're getting (Command ignored. Unknown target: undefined, target being the tracker name you're referring to).

Now what I don't understand, is that the screenshot you provided, the Google Analytics settings look pretty much standard, whereas in the debug, we see custom fields trying to be assigned ({2: null, 3: null, 6: "1", 10: false). GA seems confused by that syntax, hence why it ignores your {name: "gtm5"} option and assign the default t0 name.

Are you sure the screenshot you provided is related to the debug we see (for me it doesn't seem like so, the GTM debug mode would help you find out).

Upvotes: 1

Related Questions