Integrated Conversion Measurement uses the On Device Measurement (ODM): Event Data SDK to enhance measurement for iOS conversions. You can access the ODM SDK from the following sources:
Learn more about implementing on-device conversion measurement with a standalone SDK.
The following steps outline how to leverage the ODM SDK.
Integrate the standalone SDK
You can access the ODM standalone SDK using CocoaPods and Swift Package Manager.
Swift Package Manager
- In Xcode, go to File, then Add Packages.
- Select the GoogleAdsOnDeviceConversion GitHub repository in the prompt.
After you're finished, Xcode will begin resolving your package dependencies and downloading them in the background.
CocoaPods
Add the GoogleAdsOnDeviceConversion pod to your Podfile.
pod 'GoogleAdsOnDeviceConversion'
Run
pod install --repo-update
.
Use the On Device Measurement (ODM): Event Data SDK
Once you retrieve the ODM SDK, fetch the conversion info shortly after the app
first launches, preceding the first_open
conversion event being sent to the
App Conversion API.
Swift
Import
GoogleAdsOnDeviceConversion
.import GoogleAdsOnDeviceConversion
Set the time when the app was first launched.
ConversionManager.sharedInstance.setFirstLaunchTime(Date())
Fetch the conversion info.
ConversionManager.sharedInstance.fetchAggregateConversionInfo( for: .installation) { aggregateConversionInfo, error in guard error == nil else { return } guard let info = aggregateConversionInfo else { return } guard info.count > 0 else { return } print("Conversion info \(info)") }
To troubleshoot:
- Check that the Date passed to
setFirstLaunchTime()
was when the app first launched. - Check that your app is running in an approved region.
Use info as the value in the odm_info
query parameter in the App
Conversion API. For example, if the info is "abcdEfadGdaf", then
odm_info=abcdEfadGdaf
.
Objective-C
Import
GoogleAdsOnDeviceConversion
.@import GoogleAdsOnDeviceConversion;
Set the time when the app was first launched.
[[ODCConversionManager sharedInstance] setFirstLaunchTime:[NSDate date]];
Fetch the conversion info.
[[ODCConversionManager sharedInstance] fetchAggregateConversionInfoForInteraction:ODCInteractionTypeInstallation completion:^(NSString * _Nullable aggregateConversionInfo, NSError * _Nullable error) { if (error) { return; } if (aggregateConversionInfo.length == 0) { return; } NSLog(@"Conversion info %@", aggregateConversionInfo); // Use aggregateConversionInfo as the value in the odm_info query // parameter in the App Conversion API. // For example, if aggregateConversionInfo is "abcdEfadGdaf", // then odm_info=abcdEfadGdaf. }];
To troubleshoot:
- Check that the NSDate passed to
setFirstLaunchTime()
was when the app first launched. - Check that your app is running in an approved region.