Skip to content Skip to sidebar Skip to footer

Command Ignored. Unknown Target: Undefined When Setting Custom Dimension In Google Analytics Tracking Code

I am setting up a Custom Dimension in my Google Analytics Tracking Code, however I am seeing a strange error in the Chrome Console with the Google Analytics Debugger switched on. T

Solution 1:

You need to use your tracker names in the "set" command, else GA will apply the command to the default tracker t0 (which does not exist in your example):

  ga('crmpiccoglobal.set', 'dimension1', 'premium');
  ga('crmpiccoregion.set', 'dimension1', 'premium');

  ga('crmpiccoglobal.send', 'pageview');
  ga('crmpiccoregion.send', 'pageview');

Solution 2:

If you use Google Tag Manager to load your Google Analytics and you don't know what tracker is being created, use this:

sendGa(name : string, data: any) {
    (<any>window).ga(() => {
        const trackers = (<any>window).ga.getAll();
        const firstTracker = trackers[0];
        const trackerName = firstTracker.get('name');
        (<any>window).ga(trackerName + '.' + name, data);
    });
}

docs: https://developers.google.com/analytics/devguides/collection/analyticsjs/accessing-trackers

Post a Comment for "Command Ignored. Unknown Target: Undefined When Setting Custom Dimension In Google Analytics Tracking Code"