New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Dimension Issue #378

Closed
lalit241 opened this Issue Mar 1, 2017 · 11 comments

Comments

Projects
None yet
5 participants
@lalit241
Copy link

lalit241 commented Mar 1, 2017

Hello,

I am using your plugin to track view and dimension. Plugin work awesome but i am having problem with Dimension tracking on iPAD.

I am using something like that:

function initializeTracking() {

if (window.ga) {
window.ga.startTrackerWithId('xx-xxxxxxxx-xx);
}
}

function trackSenderEmail(email) {
if (window.ga) {
window.ga.addCustomDimension(1, email);

}
}

Can you guys please help me. I am facing that problem from a week and not founding any solution.

Thanks

studio-matt referenced this issue Mar 1, 2017

[fix] iOS does not track custom dimension
Solved formatting the variable “key” instead of string “42”
@lalit241

This comment has been minimized.

Copy link

lalit241 commented Mar 2, 2017

Environment:

PhoneGap application

Triggering Dimesion by jQuery code.

@studio-matt

This comment has been minimized.

Copy link

studio-matt commented Mar 2, 2017

@victorsosa

This comment has been minimized.

Copy link
Collaborator

victorsosa commented Mar 2, 2017

@lalit241 sorry, you did say which is you problem; what do you expect? more details please.

I think you issue is how to use it; when you call addCustomDimension() it doesn't send any data, it just set the dimension and after that ones you call trackView() or trackEvent() it will send the dimension in this calls.

@lalit241

This comment has been minimized.

Copy link

lalit241 commented Mar 2, 2017

Hi @victorsosa

window.ga.addCustomDimension(1, email); it work perfect in Andorid phone or tab.

My call is something like

function trackSenderEmail(email) {
if (window.ga) {
window.ga.addCustomDimension(1, email);

}
}

It fails in iOS but work perfectly in Android.

@victorsosa

This comment has been minimized.

Copy link
Collaborator

victorsosa commented Mar 2, 2017

do you get any error log? also which version of this api are you using?

@lalit241

This comment has been minimized.

Copy link

lalit241 commented Mar 2, 2017

I am using 1.7.5 version, no any error i am not getting

@scott-alvis

This comment has been minimized.

Copy link

scott-alvis commented Mar 17, 2017

I'm also having issues with custom dimensions on IOS. The first thing I noticed is that the value of the custom dimension is always passed to Google as "&cd42" = "value" and there does not appear to be another parameter for the key of the dimension. Second thing I noticed is that add a second dimension simply overrides the value of the first sending "&cd43" = "second value", the first dimension value appears no where in the data being sent to Google.

First call with with one dimension.

2017-03-17 10:34:40.523 analytics[9584:254169] GoogleAnalyticsProvider::initializeTracker -> GoogleAnalytics::startTrackerWithId -> GoogleAnalytics::addCustomDimension -> Success
2017-03-17 10:34:40.523 analytics[9584:254169] { key: 1 }
2017-03-17 10:34:40.523 analytics[9584:254169] { value: MPOS-0220-0001 }
2017-03-17 10:34:40.530 analytics[9584:254531] VERBOSE: GoogleAnalytics 3.14 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_s" = 187;
        "&_u" = ".tnoKoKDK9BL";
        "&_v" = "mi3.1.4";
        "&a" = 20***00;
        "&aclid" = "<null>";
        "&aid" = "com.ionicframework.analytics932610";
        "&an" = analytics;
        "&anid" = "<null>";
        "&ate" = "<null>";
        "&av" = "0.0.3";
        "&cc" = "<null>";
        "&cd" = "302-page-home-ionViewDidEnter";
        "&cd42" = "MPOS-0220-0001";
        "&ci" = "<null>";
        "&cid" = "a3***70";
        "&ck" = "<null>";
        "&cm" = "<null>";
        "&cn" = "<null>";
        "&cs" = "<null>";
        "&dclid" = "<null>";
        "&dm" = "x86_64";
        "&ds" = app;
        "&gclid" = "<null>";
        "&gmob_t" = "<null>";
        "&idfa" = "<null>";
        "&sr" = 750x1334;
        "&t" = screenview;
        "&tid" = "UA-********-1";
        "&uid" = "user.name";
        "&ul" = en;
        "&v" = 1;
        "&z" = 16***79;
        gaiVersion = "3.14";
    };
    timestamp = "2017-03-17 17:34:40 +0000";
}

Second call after adding another dimension.

2017-03-17 10:37:00.218 analytics[9584:254169] GoogleAnalyticsProvider::trackEvent -> GoogleAnalytics.addCustomDimension -> Success
2017-03-17 10:37:00.218 analytics[9584:254169] { key: 2, value: 0220 }
2017-03-17 10:37:00.218 analytics[9584:254531] VERBOSE: GoogleAnalytics 3.14 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
    parameters =     {
        "&_crc" = 0;
        "&_s" = 188;
        "&_u" = ".oKKDK9BL";
        "&_v" = "mi3.1.4";
        "&a" = 20***01;
        "&aclid" = "<null>";
        "&aid" = "com.ionicframework.analytics932610";
        "&an" = analytics;
        "&anid" = "<null>";
        "&ate" = "<null>";
        "&av" = "0.0.3";
        "&cc" = "<null>";
        "&cd" = "302-page-home";
        "&cd42" = 0220;
        "&ci" = "<null>";
        "&cid" = "a***0";
        "&ck" = "<null>";
        "&cm" = "<null>";
        "&cn" = "<null>";
        "&cs" = "<null>";
        "&dclid" = "<null>";
        "&dm" = "x86_64";
        "&ds" = app;
        "&gclid" = "<null>";
        "&gmob_t" = "<null>";
        "&idfa" = "<null>";
        "&sr" = 750x1334;
        "&t" = screenview;
        "&tid" = "UA-********-1";
        "&uid" = "user.name";
        "&ul" = en;
        "&v" = 1;
        "&z" = 16***80;
        gaiVersion = "3.14";
    };
    timestamp = "2017-03-17 17:37:00 +0000";
}
@victorsosa

This comment has been minimized.

Copy link
Collaborator

victorsosa commented Mar 17, 2017

@scott-alvis the 42 value overwrite issue was fixed; please update to the last ver 1.7.5

check this out f530b09

@victorsosa victorsosa added this to the 1.7.5 milestone Mar 17, 2017

@victorsosa victorsosa added the bug label Mar 17, 2017

@victorsosa victorsosa closed this Mar 17, 2017

@scott-alvis

This comment has been minimized.

Copy link

scott-alvis commented Mar 17, 2017

@victorsosa thank you for the update.

Removing ionic plugin remove cordova-plugin-google-analytics and adding it back ionic plugin add cordova-plugin-google-analytics doesn't appear to get the update.

I went ahead and updated UniversalAnalyticsPlugin.m directly and the fix is working.

Thanks again!

@mobyjames

This comment has been minimized.

Copy link

mobyjames commented Mar 26, 2017

Same... removed and re-added and still seeing this:

Note 42 hardcoded.

- (void) addCustomDimensionsToTracker: (id<GAITracker>)tracker
{
    if (_customDimensions) {
      for (NSString *key in _customDimensions.allKeys) {
        NSString *value = [_customDimensions objectForKey:key];

        NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
        f.numberStyle = NSNumberFormatterDecimalStyle;
        NSNumber *myKey = [f numberFromString:@"42"];

        /* NSLog(@"Setting tracker dimension slot %@: <%@>", key, value); */
        [tracker set:[GAIFields customDimensionForIndex:myKey.unsignedIntegerValue]
        value:value];
      }
    }
}
@mobyjames

This comment has been minimized.

Copy link

mobyjames commented Mar 26, 2017

It must be getting cached somewhere- feel free to use this fork, which is just a copy of 1.7.5, but "breaks" whatever was caching it for me: https://github.com/mobyinc/google-analytics-plugin.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment