applicationUpdate
The applicationUpdate() method records an app update. The SDK sends it at most once for each distinct version it takes from your app bundle: the short version string and build number together (the same default pairing described under appVersion). Bumping only the build number is enough to count as a new version for this method.
Syntax
PiwikTracker.sharedInstance()?.applicationUpdate()[[PiwikTracker sharedInstance] applicationUpdate];Examples
Call applicationUpdate() from App.init() immediately after configuring the tracker:
@main
struct MyApp: App {
init() {
PiwikTracker.sharedInstance(
siteID: "site-id",
baseURL: URL(string: "https://example.piwik.pro")!
)
PiwikTracker.sharedInstance()?.applicationUpdate()
}
var body: some Scene {
WindowGroup { ContentView() }
}
}Or from application(_:didFinishLaunchingWithOptions:) when you use an AppDelegate:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
PiwikTracker.sharedInstance(siteID: "site-id", baseURL: URL(string: "https://example.piwik.pro")!)
PiwikTracker.sharedInstance()?.applicationUpdate()
return true
}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[PiwikTracker sharedInstanceWithSiteID:@"site-id" baseURL:[NSURL URLWithString:@"https://example.piwik.pro"]];
[[PiwikTracker sharedInstance] applicationUpdate];
return YES;
}Notes
- Call
applicationUpdate()immediately after configuring the tracker, in the same place you typically callapplicationInstall(). - Further launches on the same bundle version do not enqueue another update event. The boolean return value indicates whether a new event was queued.
- Deduplication uses the version read from
Info.plist, not the optionalappVersionoverride used on other events. - On the first launch of a fresh install, both
applicationInstall()andapplicationUpdate()can each send one event for the initial bundle version.
Related methods
Updated 15 days ago