Simple app install/update behavior detection.

Overview

App-Update-Tracker

AppUpdateTracker is a simple, lightweight iOS library intended to determine basic app install/update behavior. The following is a list of when events are triggered:

  • when the user launches the app for the first time, provides:
    • timestamp of when user opened app for the first time, in seconds since epoch
    • installation count representing the number of times the user has opened the app for the first time on the same device
  • when the user opens the app for the first time after updating, provides:
    • the previous version the user updated from
    • the current version of the app (provided for convenience)
  • when the user brings the app to the foreground, provides:
    • usage count representing how many times the app has been opened (includes bringing app to foreground after resigning active, not only cold start)

This library posts an alert or executes a block with information on one (and only one) of the 3 aforementioned behaviors per app session (each time the app is run).

How to Add to Your Project

CocoaPods

To install with CocoaPods include the following in your Podfile:

pod 'App-Update-Tracker', '~> 2.0'

Then install:

$ pod install

Consult the "Getting Started" guide (taken from the lovely AFNetworking project) for more information.

The Old Fashioned Way

Merely copy the AppUpdateTracker folder (and its contents) to your project.

Usage

Import AppUpdateTracker.h in your AppDelegate class and register for AppUpdateTracker events within the application:didFinishLaunchingWithOptions: method:

#import "AppUpdateTracker.h"

//...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    
    [AppUpdateTracker registerForAppUpdatesWithBlock:^(NSString *previousVersion, NSString *currentVersion) {
        NSLog(@"app updated from: %@ to: %@", previousVersion, currentVersion);
    }];
    [AppUpdateTracker registerForFirstInstallWithBlock:^(NSTimeInterval installTimeSinceEpoch, NSUInteger installCount) {
        NSLog(@"first install detected at: %f amount of times app was (re)installed: %lu", installTimeSinceEpoch, (unsigned long)installCount);
    }];
    [AppUpdateTracker registerForIncrementedUseCountWithBlock:^(NSUInteger useCount) {
        NSLog(@"incremented use count to: %lu", (unsigned long)useCount);
    }];
    
    //...
}

Consult the sample project for more info.

Migration

1.x to 2.0

Potential codebreaking changes:

  • Added installCount to first install event, this changes the first install block registration method to + (void)registerForFirstInstallWithBlock:(void (^)(NSTimeInterval installTimeSinceEpoch, NSUInteger installCount))block.
  • Changed oldVersion to previousVersion for app updated event, this changes the notification previous version key to kAUTNotificationUserInfoPreviousVersionKey.
  • Added currentVersion to app updateded event, this changes the app updated block registration method to + (void)registerForAppUpdatesWithBlock:(void (^)(NSString *previousVersion, NSString *currentVersion))block.
  • Changed + (BOOL)getUserUpgradedApp to + (BOOL)getUserUpdatedApp.

License

MIT License

Copyright (c) 2012, Aaron Jubbal All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Simple and blunt static site generator

StaticSite This contains a bunch of helper functions to generate a static site in Swift.

Simple way to set up half modal view
Simple way to set up half modal view

HalfModalView Requirements iOS 9.0+ Xcode 10.0+ Swift 4.0+ Example Installation CocoaPods is a dependency manager for Cocoa projects. You can install

A simple Swift package for counting the Syllables in a sentence.

A simple Swift package for counting the Syllables in a sentence.

Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image
Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image

Change menu bar color in macOS Big Sur Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wal

A simple Swift utility for producing pseudolocalized strings.
A simple Swift utility for producing pseudolocalized strings.

Build your App UI to adapt and respond to translations, and find localization bugs!

Swordinator is a simple way of integrating an iOS Coordinator pattern.
Swordinator is a simple way of integrating an iOS Coordinator pattern.

Swordinator is a minimal, lightweight and easy customizable navigation framework for iOS applications. Requirements iOS 14.0+, Swift 5.0+ Installation

AnalyticsKit for Swift is designed to combine various analytical services into one simple tool.

🦋 AnalyticsKit AnalyticsKit for Swift is designed to combine various analytical services into one simple tool. To send information about a custom eve

A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar.

bose-macos-utility A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar. Why Have you e

Angle is a simple Swift library that provides Angle structure representing angles.

Angle is a simple Swift library that provides Angle structure representing angles. It handles angles using circular measure by default but is al

Comments
  • Add Legacy Support for Install Count

    Add Legacy Support for Install Count

    Install count detection works currently only for new clients, not for those that are legacy. Add logic to create the appropriate key in the keychain (with value of 1) if nonexistent, for existing users.

    enhancement 
    opened by Stunner 0
Updeto is a simple package that help update checker for iOS Apps

Updeto is a simple package that will help you to check if the currently installed version is the same as the latest one available on App Store.

Manuel Sánchez 8 Jul 8, 2022
Showcase new features after an app update similar to Pages, Numbers and Keynote.

WhatsNew Description WhatsNew automatically displays a short description of the new features when users update your app. This is similar to what happe

Patrick Balestra 1.5k Jan 4, 2023
Checks if there is a newer version of your app in the AppStore and alerts the user to update.

YiAppUpdater Checks if there is a newer version of your app in the AppStore and alerts the user to update. Installation YiAppUpdater is available thro

coderyi 4 Mar 17, 2022
A simple Pokedex app written in Swift that implements the PokeAPI, using Combine and data driven UI.

SwiftPokedex SwiftPokedex is a simple Pokedex app written by Viktor Gidlöf in Swift that implements the PokeAPI. For full documentation and implementa

Viktor G 26 Dec 14, 2022
Simple and Lightweight App Version Tracking for iOS written in Swift

AEAppVersion Simple and lightweight iOS App Version Tracking written in Swift I made this for personal use, but feel free to use it or contribute. For

Marko Tadić 12 Nov 11, 2022
It is a simple maths quiz app that will help users to test their math skills.

MathQuiz It is a simple maths quiz app that will help users to test their math skills. It has the following screens 1.Welcome screen with start button

null 0 Dec 27, 2021
Unit-Converter-SwiftUI - A simple Unit Converter iOS app built in the process of learning SwiftUI

SwiftUI-Unit-Converter A simple Unit Converter iOS app built in the process of l

Ishaan Bedi 2 Jul 13, 2022
Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

Roy Marmelstein 2.3k Jan 3, 2023
RandomKit is a Swift framework that makes random data generation simple and easy.

RandomKit is a Swift framework that makes random data generation simple and easy. Build Status Installation Compatibility Swift Package Manager CocoaP

Nikolai Vazquez 1.5k Dec 29, 2022
A simple shake-one-shake, Convenient for us to integrate the shake-one-shake.

MGSwiftShaker Example To run the example project, clone the repo, and run pod install from the Example directory first.

null 3 Nov 21, 2021