शुरू करें

यह गाइड उन पब्लिशर के लिए है जो AdMob के ज़रिए iOS ऐप्लिकेशन से कमाई करना चाहते हैं और Firebase का इस्तेमाल नहीं कर रहे हैं. अगर आपको अपने ऐप्लिकेशन में Firebase को शामिल करना है (या आपको ऐसा करना है), तो इस गाइड का Firebase के साथ AdMob वर्शन देखें.

Google Mobile Ads SDK को किसी ऐप्लिकेशन में इंटिग्रेट करना, विज्ञापन दिखाने और कमाई करने की दिशा में पहला कदम है. SDK टूल को इंटिग्रेट करने के बाद, एक या एक से ज़्यादा इस्तेमाल किए जा सकने वाले विज्ञापन फ़ॉर्मैट लागू करें.

ज़रूरी शर्तें

  • Xcode 14.1 या उसके बाद के वर्शन का इस्तेमाल करें
  • टारगेट iOS 11.0 या इसके बाद का वर्शन

मोबाइल विज्ञापन SDK इंपोर्ट करना

CocoaPods (पसंदीदा)

किसी iOS प्रोजेक्ट में SDK टूल इंपोर्ट करने का सबसे आसान तरीका है, CocoaPods का इस्तेमाल करना. अपने प्रोजेक्ट की Podfile खोलें और इस लाइन को अपने ऐप्लिकेशन के टारगेट में जोड़ें:

pod 'Google-Mobile-Ads-SDK'

फिर कमांड लाइन से:

pod install --repo-update

अगर CocoaPods का इस्तेमाल पहले कभी नहीं किया गया है, तो Podfiles बनाने और उन्हें इस्तेमाल करने के तरीके के बारे में जानने के लिए, उनका आधिकारिक दस्तावेज़ देखें.

स्विफ़्ट पैकेज मैनेजर

Google Mobile Ads SDK के साथ Swift Package Manager का 9.0.0 वर्शन शुरू होता है. Swift पैकेज इंपोर्ट करने के लिए नीचे दिया गया तरीका अपनाएं.

  1. Xcode में, फ़ाइल > पैकेज जोड़ें... पर जाकर, Google Mobile Ads का Swift Package इंस्टॉल करें.

  2. स्क्रीन पर दिखने वाले प्रॉम्प्ट में, Google Mobile Ads का Swift Package GitHub रिपॉज़िटरी खोजें:

    https://github.com/googleads/swift-package-manager-google-mobile-ads.git
    
  3. Google Mobile Ads के Swift पैकेज का वह वर्शन चुनें जिसका आपको इस्तेमाल करना है. नए प्रोजेक्ट के लिए, हमारा सुझाव है कि आप अगला मेजर वर्शन तक का इस्तेमाल करें.

इसके बाद, Xcode आपके पैकेज डिपेंडेंसी को ठीक करना शुरू करेगा और उन्हें बैकग्राउंड में डाउनलोड करेगा. पैकेज डिपेंडेंसी जोड़ने के तरीके के बारे में ज़्यादा जानकारी के लिए, Apple का लेख पढ़ें.

मैन्युअल तरीके से डाउनलोड करें

  1. SDK टूल के फ़्रेमवर्क को सीधे तौर पर डाउनलोड और अनज़िप करें. साथ ही, नीचे दिए गए फ़्रेमवर्क को अपने Xcode प्रोजेक्ट में इंपोर्ट करें:

    • GoogleAppMeasurement.xcframework
    • GoogleAppMeasurementIdentitySupport.xcframework
    • GoogleMobileAds.xcframework
    • GoogleUtilities.xcframework
    • nanopb.xcframework
    • PromisesObjC.xcframework
    • UserMessagingPlatform.xcframework
  2. अपने प्रोजेक्ट की बिल्ड सेटिंग में -ObjC लिंकर फ़्लैग को अन्य लिंकर फ़्लैग में जोड़ें:

अपनी Info.plist अपडेट करें

दो कुंजियां जोड़ने के लिए, अपने ऐप्लिकेशन की Info.plist फ़ाइल अपडेट करें:

  1. GADApplicationIdentifier कुंजी, जिसकी स्ट्रिंग वैल्यू आपके AdMob app ID found in the AdMob UIकी है.

  2. Google (cstr6suwn9.skadnetwork) के लिए SKAdNetworkIdentifier वैल्यू वाली SKAdNetworkItems कुंजी और तीसरे पक्ष के उन खरीदारों को चुनें जिन्होंने Google को ये वैल्यू दी हैं.

स्निपेट पूरा करें

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>SKAdNetworkItems</key>
<array>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cstr6suwn9.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4fzdc2evr5.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4pfyvq9l8r.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2fnua5tdw4.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ydx93a7ass.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5a6flpkh64.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>p78axxw29g.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v72qych5uu.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ludvb6z3bs.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cp8zw746q7.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3sh42y64q3.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>c6k4g5qg8m.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>s39g8k73mm.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qy4746246.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>f38h382jlk.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>hs6bdukanm.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v4nxqhlyqp.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>wzmmz9fp6w.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>yclnxrl5pm.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>t38b2kh725.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>7ug5zh24hu.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>gta9lk7p23.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>vutu7akeur.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>y5ghdn5j9k.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n6fk4nfna4.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v9wttpbfk9.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n38lu8286q.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>47vhws6wlr.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>kbd757ywx3.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9t245vhmpl.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>eh6m2bh4zr.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>a2p9lx4jpn.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>22mmun2rn5.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4468km3ulz.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2u9pt9hc89.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8s468mfl3y.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>klf5c3l5u5.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ppxm28t8ap.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ecpz2srf59.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>uw77j35x4d.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>pwa73g5rt2.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mlmmfzh3r3.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>578prtvx9j.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4dzt52r2t5.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>e5fvkxwrpn.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8c4e2ghe7u.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>zq492l623r.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3rd42ekr43.skadnetwork</string>
  </dict>
  <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qcr597p9d.skadnetwork</string>
  </dict>
</array>

अगर आपने अभी तक AdMob खाता नहीं बनाया है और ऐप्लिकेशन को रजिस्टर नहीं किया है, तो अब ऐसा करने का सही समय है.

Mobile Ads SDK शुरू करें

विज्ञापन लोड करने से पहले, GADMobileAds.sharedInstance पर startWithCompletionHandler: तरीके को कॉल करें. यह SDK टूल शुरू करता है और शुरू होने के पूरा होने (या 30 सेकंड के टाइम आउट के बाद) पर पूरा होने वाले हैंडलर को कॉल करता है. यह काम सिर्फ़ एक बार करना होता है, खास तौर पर ऐप्लिकेशन लॉन्च के समय. आपको startWithCompletionHandler: पर जल्द से जल्द कॉल करना चाहिए.

यहां दिए गए उदाहरण से पता चलता है कि AppDelegate में startWithCompletionHandler: तरीके को कैसे कॉल किया जाता है:

AppRelease.m का उदाहरण (excerpt)

Swift

import GoogleMobileAds

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    GADMobileAds.sharedInstance().start(completionHandler: nil)

    return true
  }

}

Objective-C

@import GoogleMobileAds;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [GADMobileAds.sharedInstance startWithCompletionHandler:nil];
  return YES;
}

@end

अगर मीडिएशन का इस्तेमाल किया जा रहा है, तो विज्ञापन लोड करने से पहले, पूरा होने वाले हैंडलर को कॉल किए जाने तक इंतज़ार करें. इससे सभी मीडिएशन अडैप्टर शुरू हो जाएंगे.

कोई विज्ञापन फ़ॉर्मैट चुनें

Mobile Ads SDK को इंपोर्ट और शुरू कर दिया गया है. अब आप विज्ञापन लागू करने के लिए तैयार हैं. AdMob कई अलग-अलग विज्ञापन फ़ॉर्मैट हैं, ताकि आप अपने ऐप्लिकेशन के उपयोगकर्ता अनुभव के हिसाब से सबसे सही विज्ञापन फ़ॉर्मैट चुन सकें.

डिवाइस की स्क्रीन पर सबसे ऊपर या नीचे दिखने वाले आयताकार विज्ञापन. जब उपयोगकर्ता आपके ऐप्लिकेशन के साथ इंटरैक्ट करते हैं, तब बैनर विज्ञापन स्क्रीन पर बने रहते हैं. ये एक तय समय के बाद अपने-आप रीफ़्रेश हो सकते हैं. अगर आपको मोबाइल पर विज्ञापन देने के लिए नए ऐप्लिकेशन नहीं हैं, तो शुरुआत करने के लिए ये बेहतरीन जगह हैं.

बैनर लागू करना

मध्यवर्ती

फ़ुल-स्क्रीन विज्ञापन, जो ऐप्लिकेशन के इंटरफ़ेस को तब तक ढकते हैं, जब तक उपयोगकर्ता उन्हें बंद नहीं कर देते. इन सुविधाओं का सबसे सही तरीके से इस्तेमाल तब किया जाता है, जब ऐप्लिकेशन पर काम करने के दौरान थोड़ी देर रुक जाती हो. जैसे, गेम के अलग-अलग लेवल के बीच में या टास्क के पूरा होने के तुरंत बाद.

पेज पर अचानक दिखने वाले विज्ञापन को लागू करना

नेटिव लेआउट

पसंद के मुताबिक बनाए जा सकने वाले ऐसे विज्ञापन जो आपके ऐप्लिकेशन के लुक और स्टाइल के मुताबिक होते हैं. ये आपके तय किए जाते हैं कि उन्हें कैसे और कहां दिखाया जाएगा, ताकि लेआउट आपके ऐप्लिकेशन के डिज़ाइन के हिसाब से बेहतर हो.

लागू करें Native Ads

इनाम दिया गया

ऐसे विज्ञापन जो उपयोगकर्ताओं को छोटे वीडियो देखने और गेम खेलने देने वाले विज्ञापन और सर्वे से इंटरैक्ट करने पर इनाम देते हैं. मुफ़्त में खेले जाने वाले गेम के उपयोगकर्ताओं से कमाई करने के लिए बेहतर है.

इनाम वाले विज्ञापन लागू करना इनाम वाले विज्ञापन (नए एपीआई) लागू करना