//// MyNotifier.h//#import "TAGContainerOpener.h"@interfaceMyNotifier : NSObject<TAGContainerOpenerNotifier>@end//// MyNotifier.m//#import "AppDelegate.h"#import "MyNotifier.h"#import "TAGDataLayer.h"#import "TAGManager.h"@implementationMyNotifier-(void)containerAvailable:(TAGContainer*)container{AppDelegate*appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];if(appDelegate.appLaunchEventPushed==NO){// Push the app launch event once after the container is opened.[[TAGManagerinstance].dataLayerpush:@{@"event":@"appLaunch"}];appDelegate.appLaunchEventPushed=YES;}}@end//// AppDelegate.m//#import "AppDelegate.h"#import "MyNotifier.h"#import "TAGDataLayer.h"#import "TAGManager.h"@implementationAppDelegate-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{// MyNotifier::containerAvailable: is called when the container is opened.[TAGContainerOpeneropenContainerWithId:@"GTM-XXXX"tagManager:[TAGManagerinstance]openType:kTAGOpenTypePreferNonDefaulttimeout:nilnotifier:[[MyNotifieralloc]init]];// Rest of the method implementation.returnYES:}// Rest of the AppDelegate implementation@end
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThis guide outlines how to set up Google Ads conversion tracking for iOS app downloads using Google Tag Manager and trigger-based tracking.\u003c/p\u003e\n"],["\u003cp\u003eYou will need to create a new conversion in Google Ads and corresponding tags and triggers within Google Tag Manager.\u003c/p\u003e\n"],["\u003cp\u003eThe setup involves pushing an "appLaunch" event to the data layer when the app starts and configuring triggers to fire the conversion tag.\u003c/p\u003e\n"],["\u003cp\u003eFor deep linking conversions, push the deep link URL to the data layer as "gtm.url" for accurate tracking.\u003c/p\u003e\n"],["\u003cp\u003eEnsure the IDFA (Identifier for Advertisers) is accessible by including necessary libraries and frameworks in your iOS application.\u003c/p\u003e\n"]]],["This guide details how to implement Google Ads conversion tracking for iOS app downloads using Google Tag Manager. Key actions include creating a new conversion in Google Ads, and setting up blocking and firing triggers in Google Tag Manager based on iOS version and app launch events. A Google Ads conversion tracking tag is then created, utilizing copied conversion ID and label. The process also includes pushing the `appLaunch` event to the data layer and handling deep links. Finally, the container is published, and instructions on enabling access to the Identifier for Advertisers (IDFA) are provided.\n"],null,["# Google Ads Conversion Tracking\n\nGoogle Tag Manager supports flexible, trigger-based Google Ads conversion tracking\nin iOS 6 using Google Ads Conversion Tracking tags. This guide uses an iOS app\ndownload conversion to show you how to configure and implement a\nGoogle Ads conversion tracking tag with Google Tag Manager.\n\nTo configure and implement Google Ads conversion tracking for an iOS app download:\n\n1. [Create a new conversion in Google Ads](#create-conversion)\n2. [Create blocking and firing triggers](#create-rule)\n3. [Create an Google Ads conversion tracking tag](#create-tag)\n4. [Push conversion event to data layer](#push-event)\n5. [Record deep links](#record-deep-links)\n6. [Publish the container](#publish)\n7. [Access identifier for advertisers (IDFA)](#access-idfa)\n\n1. Create a new conversion in Google Ads\n----------------------------------------\n\nTo create a new conversion in Google Ads:\n\n1. Sign in to your [Google Ads](//ads.google.com) account.\n2. At the menu bar, select **Tools \\\u003e Conversions**.\n3. Click **+ CONVERSION**.\n4. Select **App**.\n5. Select **App downloads** and **iOS** and click **Continue**.\n6. Enter the following:\n - Click **Name** to enter the name of the iOS app and click **Done**.\n - Click **Value** to enter a value for each download, or select **Don't assign a value to this download** , and click **Done**.\n - Click **Optimization** , which is selected by default. To turn off optimization, click **ON** to toggle it to **OFF** and click **Done**.\n - (Optional) Click **Postback URL** to enter the URL from your analytics provider where you'd like conversions to be posted and click **Done**.\n7. Click **Save and continue**.\n8. Review your conversion settings. To change the settings, click **Edit settings**.\n9. Under **Set up your tracking method** , select **Put tracking code into the app** . See the screenshot of setting up conversion tracking.\n10. Click **Save instructions and code** or **Email instruction and code** to save the `conversionId` and `label` values.\n11. Click **Done**.\n\n2. Create blocking and firing triggers\n--------------------------------------\n\nIn the Google Tag Manager interface, create blocking and firing triggers that\nwill determine when the conversion tracking tag will be fired.\n\nBecause Google Ads conversion tags are only supported on iOS v6.0 or\nhigher, you need to create two triggers:\n\n- [Blocking trigger](#blocking-trigger) \n The `os version` is less than 6.0.\n- [Firing trigger](#firing-trigger) \n The `event` is `appLaunch` and the `platform` is `iOS`.\n\n#### To create a blocking trigger in Google Tag Manager:\n\n1. Sign in to your [Google Tag Manager](//tagmanager.google.com) account.\n2. Select a mobile container.\n3. On the left navigation bar, click **Triggers**.\n4. Click **New**.\n5. Click **Untitled Trigger** to enter the trigger name **osVersionPre6**.\n6. Under **Fire On** , enter the following condition:\n\n7. Click **Create Trigger**.\n\n#### To create a firing trigger in Google Tag Manager:\n\n1. Sign in to your [Google Tag Manager](//tagmanager.google.com) account.\n2. Select a mobile container.\n3. On the left navigation bar, click **Triggers**.\n4. Click **New** and select **Custom Trigger**.\n5. Click **Untitled Trigger** to enter the trigger name **fire when event equals appLaunch and platform equals iOS**.\n6. Under **This trigger fires on** , select **Some Events** and enter the following conditions:\n\n7. Click **Create Trigger**.\n\n3. Create a Google Ads conversion tag\n-------------------------------------\n\nIn the Google Tag Manager Interface, use the following configuration values\nto create a new Google Ads conversion tracking tag to track an app download\nas a conversion:\n\n\nTag Name : `iOS App Download Conversion` \n\nTag Type : `Google Ads Conversion Tracking` \n\nConversion ID : *Copy `conversionId` from Google Ads Snippet* \n\nConversion Label : *Copy `label` from Google Ads Snippet* \n\nConversion Value : *Does not need to match Google Ads Snippet* \n\nUnrepeatable : `Yes` \n\nFiring Trigger: `fire when event equals appLaunch and platform equals iOS` \n\nBlocking Trigger: `osVersionPre6`\nSee the blocking trigger screenshot.\nSee the firing trigger screenshot.\n| **Caution** : Be sure to select the **Unrepeatable** checkbox. This will ensure that the tag will only fire once in the lifetime of the app.\n\n4. Push the conversion event into the data layer\n------------------------------------------------\n\nAdd code to your app to push the event that will trigger the conversion\nto the data layer. For example, to track an app download, push an event with\nthe value `appLaunch` to the data layer one time after your app\nlaunches and the Tag Manager container is available. \n\n```objective-c\n//\n// MyNotifier.h\n//\n#import \"TAGContainerOpener.h\"\n\n@interface MyNotifier : NSObject\u003cTAGContainerOpenerNotifier\u003e\n\n@end\n\n//\n// MyNotifier.m\n//\n#import \"AppDelegate.h\"\n#import \"MyNotifier.h\"\n#import \"TAGDataLayer.h\"\n#import \"TAGManager.h\"\n\n@implementation MyNotifier\n\n- (void)containerAvailable:(TAGContainer *)container {\n\n AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];\n\n if (appDelegate.appLaunchEventPushed == NO) {\n // Push the app launch event once after the container is opened.\n [[TAGManager instance].dataLayer push:@{@\"event\": @\"appLaunch\"}];\n appDelegate.appLaunchEventPushed = YES;\n }\n}\n\n@end\n\n//\n// AppDelegate.m\n//\n#import \"AppDelegate.h\"\n#import \"MyNotifier.h\"\n#import \"TAGDataLayer.h\"\n#import \"TAGManager.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n\n // MyNotifier::containerAvailable: is called when the container is opened.\n [TAGContainerOpener openContainerWithId:@\"GTM-XXXX\"\n tagManager:[TAGManager instance]\n openType:kTAGOpenTypePreferNonDefault\n timeout:nil\n notifier:[[MyNotifier alloc] init]];\n\n // Rest of the method implementation.\n return YES:\n}\n\n// Rest of the AppDelegate implementation\n\n@end\n```\n\n5. Record deep links\n--------------------\n\nIf your app uses deep linking, to record a deep linking conversion,\npush the link to the data layer as `\"gtm.url\"` inside the\n`application:handleOpenURL` in the `AppDelegate`: \n\n```objective-c\n[[TAGManager instance].dataLayer push:@{@\"gtm.url\": [url absoluteString]}];\n[[TAGManager instance] previewWithURL:url];\n```\n\n6. Publish the container\n------------------------\n\nYou can now publish your container to begin sending conversion tracking pings\nto Google Ads. See [Publishing and Versions](//support.google.com/tagmanager/answer/2699097) for details.\n\nFor additional information about Google Ads conversion\ntracking, including any questions about how conversions are reported,\nsee [Understanding conversion tracking](https://support.google.com/google-ads/answer/1722022).\n\n7. Access identifier for advertisers (IDFA)\n-------------------------------------------\n\nTo enable your iOS application to access the identifier for\nadvertisers (IDFA):\n\n- Include library `libAdIdAccess.a` in the actual target.\n- In the linker options, specify `-ObjC` or `-force_Load` for the actual target.\n- Include `AdSupport.framework` in the actual target."]]