How does flurry analytics track my apps version number?
Asked Answered
Z

2

5

I'm viewing my top used version numbers in flurry for my app. It appears flurry is using the build number field (bundle version) in my plist to report what version a particular app is. Is this true? If so, can I have use a different field in my plist? (i.e Bundle Version string short) How? I frequently change the build number and I want to see something like 1.0.1 (a version) instead of 28 (a build number) in flurry.

Zampino answered 3/7, 2014 at 20:47 Comment(0)
S
14

I got bit by this too, it seems bizarre to me they would use the build number by default. I added an auto-incrementing build number script and by the time I next checked Flurry, it showed about 100 different "versions", each just a new build. Ugh, what a mess.

The good news is the Flurry API provides a way to explicitly set the reported app version at runtime. I have a #define in my prefix file that links to the "short version string", which in Apple's system is basically your user-facing app version (e.g. "1.0.2"), and is probably the one you want to be tracked in Flurry.

#define kAppVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]

Doing it this way means that you don't have to remember to set the version in more than one place. Set it in your target's "Identity" section or in the Info.plist file and you're done.

Then in my app delegate's application:didFinishLaunchingWithOptions: method, when I start up Flurry collections, I tell it to use that.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Flurry setCrashReportingEnabled:YES];
    [Flurry setAppVersion:kAppVersion]; // <-- will now report your short version string
    [Flurry startSession:kFlurryAPIKey];
    // ...
}
Streamy answered 30/7, 2014 at 17:27 Comment(2)
I did this but I'm not seeing the new version strings showing up in the versions dropdown in the dashboardAdelric
@Dan F, maybe try setting the version more directly first ("[Flurry setAppVersion: @"1.0"];. Also make sure you make that call before you call startSession, it won't work if you call it afterwards.Streamy
P
2

Above method is deprecated instead user as below.

    if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
        Flurry.startSession("xxxxxxxxxxxxxxxxxxx", with: FlurrySessionBuilder
            .init()
            .withCrashReporting(true)
            .withLogLevel(FlurryLogLevelAll).withAppVersion(version))
    }
Poling answered 5/8, 2017 at 5:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.