Integrated Conversion Measurement

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

  1. In Xcode, go to File, then Add Packages.
  2. 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

  1. Add the GoogleAdsOnDeviceConversion pod to your Podfile.

    pod 'GoogleAdsOnDeviceConversion'
    
  2. 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

  1. Import GoogleAdsOnDeviceConversion.

    import GoogleAdsOnDeviceConversion
    
  2. Set the time when the app was first launched.

    ConversionManager.sharedInstance.setFirstLaunchTime(Date())
    
  3. 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:

  1. Check that the Date passed to setFirstLaunchTime() was when the app first launched.
  2. 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

  1. Import GoogleAdsOnDeviceConversion.

    @import GoogleAdsOnDeviceConversion;
    
  2. Set the time when the app was first launched.

    [[ODCConversionManager sharedInstance] setFirstLaunchTime:[NSDate date]];
    
  3. 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:

  1. Check that the NSDate passed to setFirstLaunchTime() was when the app first launched.
  2. Check that your app is running in an approved region.