Implement on-device conversion measurement with a standalone SDK

If you aren’t able to directly integrate the on-device conversion measurement solution with the Google Analytics for Firebase (GA4F) SDK, you can do it with a standalone SDK.

In this article, you’ll learn how to integrate, use, and troubleshoot the on-device conversion measurement SDK.

Learn more About on-device conversion measurement for iOS App campaigns.

On this page


Integrate the standalone SDK

You can access the on-device conversion measurement standalone SDK via 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 GoogleAdsOnDeviceConversion SDK

After you retrieve the on-device conversion measurement SDK, fetch the conversion information shortly after the app first launches, for both first_open and reinstall_open conversions.

Swift

  1. Install the GoogleAdsOnDeviceConversion SDK to enable privacy-preserving on-device conversion measurement for iOS app campaigns.
    import GoogleAdsOnDeviceConversion
  2. Set the time to when the app was first launched.
    ConversionManager.sharedInstance.setFirstLaunchTime(Date())
  3. Fetch the conversion information.

    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)")

    }

Objective C

  1. Install the GoogleAdsOnDeviceConversion SDK to enable privacy-preserving on-device conversion measurement for iOS app campaigns.
    import GoogleAdsOnDeviceConversion
  2. Set the time to when the app was first launched.
    [[ODCConversionManager sharedInstance] setFirstLaunchTime:[NSDate date]];
  3. Fetch the conversion information.

    [[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.

    }];


Troubleshooting steps

  1. Check if the date passed to setFirstLaunchTime() was when the app first launched.

  2. Check that your app is running in the European Economic Area (EEA), the United Kingdom and Switzerland.

Ensure to use info as the value in the odm_info query parameter in the App Conversion API.

// For example, if info is "abcdEfadGdaf", then odm_info=abcdEfadGdaf

Related links

Was this helpful?

How can we improve it?
true
Achieve your advertising goals today!

Attend our Performance Max Masterclass, a livestream workshop session bringing together industry and Google ads PMax experts.

Register now

Search
Clear search
Close search
Main menu
15414208857842324261
true
Search Help Center
true
true
true
true
true
73067
false
false
false
true
false