클라이언트 라이브러리 또는 REST를 설치하고 구성하는 방법은 다음과 같습니다.
기본 요건
클라이언트 라이브러리를 설치하기 전에 애플리케이션 기본 사용자 인증 정보 (ADC) 구성을 포함한 API 액세스 설정의 단계를 완료합니다.
설치 단계
로컬 머신에 원하는 클라이언트 라이브러리를 설치합니다.
REST
- 다음 샘플의 자리표시자(예: OPERATING_ACCOUNT_PRODUCT, OPERATING_ACCOUNT_ID, AUDIENCE_ID)를 계정 및 대상의 값으로 업데이트합니다.
- PROJECT_ID를 Google Cloud의 ID로 바꿉니다.
샘플을 명령줄에 복사하여 요청을 보냅니다. 파트너 링크를 통해 운영 계정에 액세스하는 경우에만 데이터 파트너 샘플을 사용하세요. 그렇지 않은 경우 Advertiser 샘플을 사용합니다.
광고주
#!/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": [ { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3" }, { "emailAddress": "1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7" } ] } } }, { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3" }, { "emailAddress": "54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51" }, { "emailAddress": "e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478" } ] } } }, { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0" }, { "emailAddress": "f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5" } ] } } }, { "compositeData": { "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": [ { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "07e2f1394b0ea80e2adca010ea8318df697001a005ba7452720edda4b0ce57b3" }, { "emailAddress": "1df6b43bc68dd38eca94e6a65b4f466ae537b796c81a526918b40ac4a7b906c7" } ] } } }, { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "2ef46c4214c3fc1b277a2d976d55194e12b899aa50d721f28da858c7689756e3" }, { "emailAddress": "54e410b14fa652a4b49b43aff6eaf92ad680d4d1e5e62ed71b86cd3188385a51" }, { "emailAddress": "e8bd3f8da6f5af73bec1ab3fbf7beb47482c4766dfdfc94e6bd89e359c139478" } ] } } }, { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "05bb62526f091b45d20e243d194766cca8869137421047dc53fa4876d111a6f0" }, { "emailAddress": "f1fcde379f31f4d446b76ee8f34860eca2288adc6b6d6c0fdc56d9eee75a2fa5" } ] } } }, { "compositeData": { "userData": { "userIdentifiers": [ { "emailAddress": "83a834cc5327bc4dee7c5408988040dc5813c7662611cd93b707aff72bf7d33f" }, { "emailAddress": "223ebda6f6889b1494551ba902d9d381daf2f642bae055888e96343d53e9f9c4" } ] } } } ], "consent": { "adUserData": "CONSENT_GRANTED", "adPersonalization": "CONSENT_GRANTED" }, "encoding": "HEX", "termsOfService": { "customerMatchTermsOfServiceStatus": "ACCEPTED" }, "validateOnly": true } EOF
.NET
클라이언트 라이브러리 설치
.NET 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 클라이언트 라이브러리 종속 항목을 추가합니다.
선택사항: 유틸리티 라이브러리 및 코드 샘플을 가져옵니다.
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하위 디렉터리 또는 GitHub에서 코드 샘플을 살펴봅니다.samples디렉터리로 변경하고dotnet run을 사용하여 사용 가능한 샘플 목록을 가져옵니다.dotnet run샘플을 실행할 때
--help인수를 전달하여 예상 매개변수와 함께 사용법 문을 출력합니다.dotnet run -- ingest-audience-members --help샘플 데이터를 시작하려면
samples/sampledata의 파일을 사용하세요.
Go
클라이언트 라이브러리 설치
go get cloud.google.com/go/datamanager/apiv1@latest
자세한 내용은 Go 클라이언트 라이브러리 가이드를 참고하세요.
자바
클라이언트 라이브러리 설치
Java 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 클라이언트 라이브러리 종속 항목을 추가합니다.
선택사항: 유틸리티 라이브러리 설치
클라이언트 라이브러리 외에도 유틸리티 라이브러리를 설치하여 수집을 위한 데이터 형식 지정 및 암호화와 같은 일반적인 작업을 지원할 수 있습니다.
Java 프로젝트에서
data-manager-util유틸리티 라이브러리의 종속 항목을 선언합니다.Gradle:
implementation 'com.google.api-ads:data-manager-util:0.4.0'Maven:
<dependency> <groupId>com.google.api-ads</groupId> <artifactId>data-manager-util</artifactId> <version>0.4.0</version> </dependency>데이터를 포맷하고 암호화하려면 Java 프로젝트에서
UserDataFormatter및Encrypter유틸리티를 사용하세요.
코드 샘플 찾아보기
data-manager-samples 하위 디렉터리 또는 GitHub에서 코드 샘플을 살펴봅니다.
샘플을 실행하려면 다음 단계를 따르세요.
v0.4.0태그에서 GitHub 저장소를 클론합니다.git clone --branch v0.4.0 https://github.com/googleads/data-manager-java.gitdata-manager-java디렉터리로 이동합니다.필요한 인수를 전달하여 Gradle
run작업을 사용하여 명령줄에서 샘플을 실행합니다. 샘플을 실행할 때--help인수를 전달하여 예상 매개변수와 함께 사용법 문을 출력합니다.예를 들어 다음 명령어는
IngestAudienceMembers샘플을 실행하고 사용법 문을 출력합니다../gradlew data-manager-samples:run \ --args='IngestAudienceMembers --help'
샘플 데이터를 시작하려면 data-manager-samples/src/main/resources/sampledata의 파일을 사용하세요.
Node.js
클라이언트 라이브러리 설치
Node.js 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 @google-ads/datamanager 클라이언트 라이브러리에 대한 종속 항목을 추가합니다.
선택사항: 유틸리티 라이브러리 설치
클라이언트 라이브러리 외에도 유틸리티 라이브러리를 설치하여 수집을 위한 데이터 형식 지정과 같은 일반적인 작업을 지원할 수 있습니다.
Node.js 프로젝트에서
@google-ads/datamanager-util유틸리티 라이브러리의 종속 항목을 선언합니다.npm install @google-ads/datamanager-util데이터를 포맷하려면 Node.js 프로젝트에서
UserDataFormatter유틸리티를 사용하세요.
코드 샘플 찾아보기
samples 하위 디렉터리 또는 GitHub에서 코드 샘플을 살펴봅니다.
샘플을 실행하려면 다음 단계를 따르세요.
v0.4.1태그에서 GitHub 저장소를 클론합니다.git clone --branch v0.4.1 https://github.com/googleads/data-manager-node.gitdata-manager-node디렉터리로 이동합니다.샘플 실행에 필요한 종속 항목을 설치합니다.
npm install필요한 인수를 전달하여 샘플을 실행합니다. 샘플을 실행할 때
--help인수를 전달하여 예상 매개변수와 함께 사용법 문을 출력합니다.예를 들어 다음 명령어는
ingest-audience-members샘플을 실행하고 사용법 문을 출력합니다.npm run ingest-audience-members -w samples -- --help
샘플 데이터를 시작하려면 samples/sampledata의 파일을 사용하세요.
PHP
클라이언트 라이브러리 설치
PHP 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 googleads/data-manager 클라이언트 라이브러리에 대한 종속 항목을 추가합니다.
선택사항: 유틸리티 라이브러리 설치
클라이언트 라이브러리 외에도 유틸리티 라이브러리를 설치하여 수집을 위한 데이터 형식 지정과 같은 일반적인 작업을 지원할 수 있습니다.
동일한 호스트에 있는 PHP 프로젝트의
composer.json파일에서 유틸리티 라이브러리의 종속 항목을 선언합니다.composer require googleads/data-manager-util데이터 형식을 지정하려면 PHP 프로젝트에서
Formatter유틸리티를 사용하세요.
코드 샘플 찾아보기
samples 하위 디렉터리 또는 GitHub에서 코드 샘플을 살펴봅니다.
샘플을 실행하려면 다음 단계를 따르세요.
v0.4.0태그에서 GitHub 저장소를 클론합니다.git clone --branch v0.4.0 https://github.com/googleads/data-manager-php.gitdata-manager-php/samples디렉터리로 이동합니다.샘플 실행에 필요한 종속 항목을 설치합니다.
composer install필요한 인수를 전달하여 샘플을 실행합니다. 샘플을 실행할 때
--help인수를 전달하여 예상 매개변수와 함께 사용법 문을 출력합니다.예를 들어 다음 명령어는
ingest_audience_members샘플을 실행하고 사용법 문을 출력합니다.php audiences/ingest_audience_members.php --help
샘플 데이터를 시작하려면 samples/sampledata의 파일을 사용하세요.
Python
클라이언트 라이브러리 설치
Python 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 google-ads-datamanager 클라이언트 라이브러리에 대한 종속 항목을 추가합니다.
선택사항: 유틸리티 라이브러리 설치
클라이언트 라이브러리 외에도 유틸리티 라이브러리를 설치하여 수집을 위한 데이터 형식 지정 및 암호화와 같은 일반적인 작업을 지원할 수 있습니다.
Python 프로젝트에서
google-ads-datamanager-util유틸리티 라이브러리의 종속 항목을 선언합니다.예를 들어 프로젝트에서
requirements.txt파일을 사용하는 경우 파일에 다음 줄을 추가합니다.google-ads-datamanager-util==0.4.0또는 유틸리티 라이브러리를 직접 설치합니다.
pip install google-ads-datamanager-util==0.4.0데이터를 포맷하고 암호화하려면 Python 프로젝트에서
Formatter및Encrypter유틸리티를 사용하세요.
코드 샘플 찾아보기
v0.4.0태그에서 GitHub 저장소를 클론합니다.git clone --branch v0.4.0 https://github.com/googleads/data-manager-python.gitdata-manager-python디렉터리로 이동합니다.샘플 실행에 필요한 종속 항목을 설치합니다.
pip install -r samples/requirements.txt필요한 인수를 전달하여 샘플을 실행합니다. 샘플을 실행할 때
--help인수를 전달하여 예상 매개변수와 함께 사용법 문을 출력합니다.예를 들어 다음 명령어는
ingest_audience_members샘플을 실행하고 사용법 문을 출력합니다.python3 samples/audiences/ingest_audience_members.py --help
샘플 데이터를 시작하려면 samples/sampledata의 파일을 사용하세요.
Ruby
클라이언트 라이브러리 설치
Ruby 클라이언트 라이브러리 설치 가이드의 안내에 따라 프로젝트에 클라이언트 라이브러리 종속 항목을 추가합니다.
다음 단계
- 잠재고객 데이터 전송에 대해 자세히 알아보세요.
- 이벤트 전송에 대해 자세히 알아보세요.
- REST 또는 RPC 참고 문서를 찾아보세요.