Skip to content
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
coderwpwo opened this issue Mar 1, 2017 · 11 comments
Closed

iOS Dimension Issue #378

coderwpwo opened this issue Mar 1, 2017 · 11 comments
Labels
Milestone

Comments

@coderwpwo
Copy link

coderwpwo 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
Solved formatting the variable “key” instead of string “42”
@coderwpwo
Copy link
Author

Environment:

PhoneGap application

Triggering Dimesion by jQuery code.

@studio-matt
Copy link

studio-matt commented Mar 2, 2017 via email

@victorsosa
Copy link
Collaborator

@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.

@coderwpwo
Copy link
Author

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
Copy link
Collaborator

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

@coderwpwo
Copy link
Author

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

@scott-alvis
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
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
@scott-alvis
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
Copy link

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
Copy link

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
Labels
Projects
None yet
Development

No branches or pull requests

5 participants