यहां क्लाइंट लाइब्रेरी या REST को इंस्टॉल और कॉन्फ़िगर करने का तरीका बताया गया है.
ज़रूरी शर्तें
क्लाइंट लाइब्रेरी इंस्टॉल करने से पहले, एपीआई ऐक्सेस सेट अप करें में दिए गए चरणों को पूरा करें. इसमें, ऐप्लिकेशन के डिफ़ॉल्ट क्रेडेंशियल (एडीसी) कॉन्फ़िगर करना भी शामिल है.
इंस्टॉल करने का तरीका
अपने लोकल मशीन पर, अपनी पसंद की क्लाइंट लाइब्रेरी इंस्टॉल करें:
REST
- यहां दिए गए सैंपल में, OPERATING_ACCOUNT_PRODUCT, OPERATING_ACCOUNT_ID, और AUDIENCE_ID जैसे प्लेसहोल्डर को अपने खाते और डेस्टिनेशन की वैल्यू से अपडेट करें.
- PROJECT_ID की जगह, अपने Google Cloud का आईडी डालें.
अनुरोध भेजने के लिए, सैंपल को कमांड लाइन में कॉपी करें. डेटा पार्टनर सैंपल का इस्तेमाल सिर्फ़ तब करें, जब पार्टनर लिंक के ज़रिए ऑपरेटिंग खाते को ऐक्सेस किया जा रहा हो. अन्य मामलों में, विज्ञापन देने वाला सैंपल इस्तेमाल करें.
विज्ञापन देने वाला
#!/bin/bash # Uses gcloud to get an access token. If the Application Default # Credentials aren't for a service account then the command that # specifies --scopes fails, so this sample falls back to the command # without the --scopes argument. DATA_MANAGER_ACCESS_TOKEN="$(gcloud auth application-default print-access-token --scopes=https://www.googleapis.com/auth/datamanager || \ gcloud auth application-default print-access-token)" # Fetches and prints the scope information for the access token. If you # get scope-related errors when you send the request in the next step, # verify that this output includes the Data Manager API scope: # https://www.googleapis.com/auth/datamanager curl https://www.googleapis.com/oauth2/v1/tokeninfo?access_token="${DATA_MANAGER_ACCESS_TOKEN}" # Sends the request. curl -X POST "https://datamanager.googleapis.com/v1/audienceMembers:ingest" \ --header "Authorization: Bearer ${DATA_MANAGER_ACCESS_TOKEN}" \ --header "x-goog-user-project: PROJECT_ID" \ --header "Content-Type: application/json" \ --data @- <<EOF { "destinations": [ { "operatingAccount": { "accountType": "OPERATING_ACCOUNT_TYPE", "accountId": "OPERATING_ACCOUNT_ID" }, "loginAccount": { "accountType": "LOGIN_ACCOUNT_TYPE", "accountId": "LOGIN_ACCOUNT_ID" }, "productDestinationId": "AUDIENCE_ID" } ], "audienceMembers": [ { "userData": { "userIdentifiers": [ { "emailAddress": "07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3" }, { "emailAddress": "1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3" }, { "emailAddress": "54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51" }, { "emailAddress": "e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0" }, { "emailAddress": "f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "83a834cc5327bc4dee7c5408988040dc5813c7662611cd93b707aff72bf7d33f" }, { "emailAddress": "223ebda6f6889b1494551ba902d9d381daf2f642bae055888e96343d53e9f9c4" } ] } } ], "consent": { "adUserData": "CONSENT_GRANTED", "adPersonalization": "CONSENT_GRANTED" }, "encoding": "HEX", "termsOfService": { "customerMatchTermsOfServiceStatus": "ACCEPTED" }, "validateOnly": true } EOFडेटा पार्टनर
#!/bin/bash # Uses gcloud to get an access token. If the Application Default # Credentials aren't for a service account then the command that # specifies --scopes fails, so this sample falls back to the command # without the --scopes argument. DATA_MANAGER_ACCESS_TOKEN="$(gcloud auth application-default print-access-token --scopes=https://www.googleapis.com/auth/datamanager || \ gcloud auth application-default print-access-token)" # Fetches and prints the scope information for the access token. If # you get scope-related errors when you send the request in the next # step, verify that this output includes the Data Manager API scope: # https://www.googleapis.com/auth/datamanager curl https://www.googleapis.com/oauth2/v1/tokeninfo?access_token="${DATA_MANAGER_ACCESS_TOKEN}" # Sends the request. curl -X POST "https://datamanager.googleapis.com/v1/audienceMembers:ingest" \ --header "Authorization: Bearer ${DATA_MANAGER_ACCESS_TOKEN}" \ --header "x-goog-user-project: PROJECT_ID" \ --header "Content-Type: application/json" \ --data @- <<EOF { "destinations": [ { "operatingAccount": { "accountType": "OPERATING_ACCOUNT_TYPE", "accountId": "OPERATING_ACCOUNT_ID" }, "loginAccount": { "accountType": "LOGIN_ACCOUNT_TYPE", "accountId": "LOGIN_ACCOUNT_ID" }, "linkedAccount": { "accountType": "LINKED_ACCOUNT_TYPE", "accountId": "LINKED_ACCOUNT_ID" }, "productDestinationId": "AUDIENCE_ID" } ], "audienceMembers": [ { "userData": { "userIdentifiers": [ { "emailAddress": "07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3" }, { "emailAddress": "1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3" }, { "emailAddress": "54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51" }, { "emailAddress": "e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0" }, { "emailAddress": "f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5" } ] } }, { "userData": { "userIdentifiers": [ { "emailAddress": "83a834cc5327bc4dee7c5408988040dc5813c7662611cd93b707aff72bf7d33f" }, { "emailAddress": "223ebda6f6889b1494551ba902d9d381daf2f642bae055888e96343d53e9f9c4" } ] } } ], "consent": { "adUserData": "CONSENT_GRANTED", "adPersonalization": "CONSENT_GRANTED" }, "encoding": "HEX", "termsOfService": { "customerMatchTermsOfServiceStatus": "ACCEPTED" }, "validateOnly": true } EOF
.NET
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, .NET क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें guide.
ज़रूरी नहीं: यूटिलिटी लाइब्रेरी और कोड सैंपल ऐक्सेस करें.
GitHub रिपॉज़िटरी का क्लोन बनाएं.
git clone https://github.com/googleads/data-manager-dotnet.gitअपने .NET प्रोजेक्ट में, यूटिलिटी लाइब्रेरी पर
ProjectReferenceडिपेंडेंसी का एलान करें. PATH_TO_UTILITY_LIBRARY की जगह, वह जगह डालें जहां आपनेdata-manager-dotnetरिपॉज़िटरी का क्लोन बनाया है.<ProjectReference Include="PATH_TO_UTILITY_LIBRARY\Google.Ads.DataManager.Util\src\Google.Ads.DataManager.Util.csproj" />डेटा को फ़ॉर्मैट करने के लिए, अपने .NET प्रोजेक्ट में
Formatterयूटिलिटी का इस्तेमाल करें.samplesसबडायरेक्ट्री या on GitHub पर, कोड सैंपल ब्राउज़ करें.samplesडायरेक्ट्री पर जाएं और उपलब्ध सैंपल की सूची पाने के लिए,dotnet runका इस्तेमाल करें.dotnet runकिसी सैंपल को चलाते समय,
--helpआर्ग्युमेंट पास करें, ताकि इस्तेमाल करने के निर्देश के साथ-साथ, ज़रूरी पैरामीटर भी दिखें.dotnet run -- ingest-audience-members --helpसैंपल डेटा के साथ शुरू करने के लिए,
samples/sampledata/audience_members_1.csvपर मौजूद फ़ाइल का इस्तेमाल करें.
Java
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, Java क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें guide.
ज़रूरी नहीं: यूटिलिटी लाइब्रेरी और कोड सैंपल ऐक्सेस करें.
GitHub रिपॉज़िटरी का क्लोन बनाएं.
git clone https://github.com/googleads/data-manager-java.gitdata-manager-javaडायरेक्ट्री पर जाएं.यूटिलिटी लाइब्रेरी बनाएं और उसे अपने लोकल Maven रिपॉज़िटरी पर पब्लिश करें.
./gradlew data-manager-util:installअपने Java प्रोजेक्ट में, यूटिलिटी लाइब्रेरी की डिपेंडेंसी का एलान करें.
Gradle:
implementation 'com.google.api-ads:data-manager-util:0.2.0'Maven:
<dependency> <groupId>com.google.api-ads</groupId> <artifactId>data-manager-util</artifactId> <version>0.2.0</version> </dependency>डेटा को फ़ॉर्मैट और एनक्रिप्ट करने के लिए, अपने Java प्रोजेक्ट में
UserDataFormatterऔरEncrypterयूटिलिटी का इस्तेमाल करें.data-manager-samplesसबडायरेक्ट्री या on GitHub पर, कोड सैंपल ब्राउज़ करें. कमांड लाइन से कोई सैंपल चलाने के लिए, Gradlerunटास्क का इस्तेमाल करें.उदाहरण के लिए, यहां दिए गए कमांड से
IngestAudienceMembersसैंपल चलता है और इस्तेमाल करने के निर्देश दिखते हैं:./gradlew data-manager-samples:run \ --args='IngestAudienceMembers --help'सैंपल डेटा के साथ शुरू करने के लिए,
data-manager-samples/src/main/resources/sampledata/audience_members_1.csvपर मौजूद फ़ाइल का इस्तेमाल करें.
Node.js
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में
@google-ads/datamanager क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, Node.js क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें
guide.
ज़रूरी नहीं: यूटिलिटी लाइब्रेरी और कोड सैंपल ऐक्सेस करें.
GitHub रिपॉज़िटरी का क्लोन बनाएं.
git clone https://github.com/googleads/data-manager-node.gitdata-manager-nodeडायरेक्ट्री पर जाएं.डिपेंडेंसी इंस्टॉल करने के लिए, यह कमांड चलाएं.
npm installutilडायरेक्ट्री पर जाएं.cd utilnpmके साथ इस्तेमाल करने के लिए, यूटिलिटी लाइब्रेरी को कंपाइल और पैक करके.tgzफ़ाइल में बदलने के लिए, यह कमांड चलाएं.npm packइस कमांड से,
google-ads-datamanager-util-0.2.0.tgzनाम का एक संग्रह बनता है. फ़ाइल की जगह नोट करें, ताकि अगले चरणों में इसका इस्तेमाल किया जा सके.अपने Node.js प्रोजेक्ट में, Data Manager API की यूटिलिटी लाइब्रेरी की डिपेंडेंसी का एलान करें. इसके लिए,
google-ads-datamanager-util-0.2.0.tgzफ़ाइल के पूरे पाथ और फ़ाइल नाम के लिए,dependenciesएंट्री जोड़ें.{ "dependencies": { ... "@google-ads/data-manager-util": "file:PATH_TO_UTILITY_LIBRARY/google-ads-datamanager-util-0.2.0.tgz", ... } }डेटा को फ़ॉर्मैट करने के लिए, अपने Node.js प्रोजेक्ट में
UserDataFormatterयूटिलिटी का इस्तेमाल करें.samplesसबडायरेक्ट्री या on GitHub पर, कोड सैंपल ब्राउज़ करें. सैंपल चलाने के लिए, यह तरीका अपनाएं:data-manager-nodeडायरेक्ट्री पर जाएं.ज़रूरी आर्ग्युमेंट पास करके, सैंपल चलाएं. किसी सैंपल को चलाते समय,
--helpआर्ग्युमेंट पास करें, ताकि इस्तेमाल करने के निर्देश के साथ-साथ, ज़रूरी पैरामीटर भी दिखें.उदाहरण के लिए, यहां दिए गए कमांड से
ingest_audience_membersसैंपल चलता है और इस्तेमाल करने के निर्देश दिखते हैं:npm run ingest-audience-members -w samples -- --help
सैंपल डेटा के साथ शुरू करने के लिए,
samples/sampledata/audience_members_1.csvपर मौजूद फ़ाइल का इस्तेमाल करें.
PHP
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में
googleads/data-manager क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, PHP क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें
गाइड.
ज़रूरी नहीं: यूटिलिटी लाइब्रेरी और कोड सैंपल ऐक्सेस करें.
GitHub रिपॉज़िटरी का क्लोन बनाएं.
git clone https://github.com/googleads/data-manager-php.gitdata-manager-phpडायरेक्ट्री पर जाएं.लाइब्रेरी के लिए डिपेंडेंसी हल करने के लिए, यह कमांड चलाएं:
composer update --prefer-distउसी होस्ट पर मौजूद अपने PHP प्रोजेक्ट की
composer.jsonफ़ाइल में, यूटिलिटी लाइब्रेरी की डिपेंडेंसी का एलान करने के लिए, यह तरीका अपनाएं:repositoriesसेक्शन में एक एंट्री जोड़ें, जोdata-manager-phpडायरेक्ट्री की जगह की ओर इशारा करती हो."repositories" : [ { "type" : "path", "url" : "PATH_TO_UTILITY_LIBRARY" } ]यूटिलिटी लाइब्रेरी की डिपेंडेंसी का एलान करें.
"require": { "googleads/data-manager-util": "@dev" }
डेटा को फ़ॉर्मैट करने के लिए, अपने PHP प्रोजेक्ट में
Formatterयूटिलिटी का इस्तेमाल करें.samplesसबडायरेक्ट्री या on GitHub पर, कोड सैंपल ब्राउज़ करें. सैंपल चलाने के लिए, यह तरीका अपनाएं:samplesडायरेक्ट्री पर जाएं.लाइब्रेरी के लिए डिपेंडेंसी हल करने के लिए, यह कमांड चलाएं:
composer update --prefer-distज़रूरी आर्ग्युमेंट पास करके, सैंपल चलाएं. किसी सैंपल को चलाते समय,
--helpआर्ग्युमेंट पास करें, ताकि इस्तेमाल करने के निर्देश के साथ-साथ, ज़रूरी पैरामीटर भी दिखें.
सैंपल डेटा के साथ शुरू करने के लिए,
samples/sampledata/audience_members_1.csvपर मौजूद फ़ाइल का इस्तेमाल करें.
Python
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में
google-ads-datamanager क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, Python क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें
guide.
ज़रूरी नहीं: यूटिलिटी लाइब्रेरी और कोड सैंपल ऐक्सेस करें.
GitHub रिपॉज़िटरी का क्लोन बनाएं.
git clone https://github.com/googleads/data-manager-python.gitdata-manager-pythonडायरेक्ट्री पर जाएं.अपने Python एनवायरमेंट में यूटिलिटी लाइब्रेरी इंस्टॉल करने के लिए, यह कमांड चलाएं:
pip install .अपने Python प्रोजेक्ट में, यूटिलिटी लाइब्रेरी की डिपेंडेंसी का एलान करें. उदाहरण के लिए, अगर अपने प्रोजेक्ट में
requirements.txtफ़ाइल का इस्तेमाल किया जा रहा है, तो फ़ाइल में यह लाइन जोड़ें:google-ads-datamanager-util=0.2.0डेटा को फ़ॉर्मैट और एनक्रिप्ट करने के लिए, अपने Python प्रोजेक्ट में
FormatterऔरEncrypterयूटिलिटी का इस्तेमाल करें.samplesसबडायरेक्ट्री या on GitHub पर, कोड सैंपल ब्राउज़ करें. सैंपल चलाने के लिए, ज़रूरी डिपेंडेंसी इंस्टॉल करें:pip install .[samples]किसी सैंपल को चलाते समय,
--helpआर्ग्युमेंट पास करें, ताकि इस्तेमाल करने के निर्देश के साथ-साथ, ज़रूरी पैरामीटर भी दिखें.सैंपल डेटा के साथ शुरू करने के लिए,
samples/sampledata/audience_members_1.csvपर मौजूद फ़ाइल का इस्तेमाल करें.
Ruby
क्लाइंट लाइब्रेरी इंस्टॉल करना
अपने प्रोजेक्ट में क्लाइंट लाइब्रेरी की डिपेंडेंसी जोड़ने के लिए, Ruby क्लाइंट लाइब्रेरी को इंस्टॉल करने के लिए दिए गए निर्देशों का पालन करें guide.
अगले चरण
- ऑडियंस डेटा भेजने के बारे में ज़्यादा जानें.
- इवेंट भेजने के बारे में ज़्यादा जानें.
- REST या RPC के रेफ़रंस के लिए दस्तावेज़ ब्राउज़ करें.