승인 필요
사용자가 액세스할 수 있는 리마케팅 잠재고객을 나열합니다. 예를 참조하세요.
요청
HTTP 요청
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/remarketingAudiences
매개변수
매개변수 이름 | 값 | 설명 |
---|---|---|
경로 매개변수 | ||
accountId |
string |
검색할 리마케팅 잠재고객의 계정 ID입니다. |
webPropertyId |
string |
검색할 리마케팅 잠재고객의 웹 속성 ID입니다. |
선택적 쿼리 매개변수 | ||
max-results |
integer |
이 응답에 포함할 리마케팅 잠재고객의 최대 수입니다. |
start-index |
integer |
검색할 첫 번째 항목의 색인입니다. 이 매개변수를 max-results 매개변수와 함께 페이지로 나누기 메커니즘으로 사용합니다. |
type |
string |
승인
이 요청에는 다음 범위 중 최소 하나를 사용하여 인증이 필요합니다. (인증 및 승인에 대해 자세히 알아보기)
범위 |
---|
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
요청 본문
이 메소드를 사용할 때는 요청 본문을 제공하지 마세요.
응답
요청에 성공할 경우 이 메소드는 다음과 같은 구조의 응답 본문을 반환합니다.
{ "kind": "analytics#remarketingAudiences", "username": string, "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.remarketingAudience Resource ] }
속성 이름 | 값 | 설명 | Notes |
---|---|---|---|
kind |
string |
컬렉션 유형입니다. | |
username |
string |
인증된 사용자의 이메일 ID | |
totalResults |
integer |
응답의 결과 수와 관계없이 쿼리의 총 결과 수입니다. | |
startIndex |
integer |
리소스의 시작 색인으로, 기본값은 1이거나 시작 색인 쿼리 매개변수에 의해 지정됩니다. | |
itemsPerPage |
integer |
반환된 실제 리소스 수와 관계없이 응답에 포함할 수 있는 최대 리소스 수 값의 범위는 1~1000이며 기본값은 1, 000이거나 max-results 쿼리 매개변수에 의해 지정됩니다. | |
previousLink |
string |
이 보기 (프로필) 컬렉션의 이전 페이지 링크입니다. | |
nextLink |
string |
이 리마케팅 잠재고객 수집의 다음 페이지로 연결되는 링크입니다. | |
items[] |
list |
리마케팅 잠재고객의 목록입니다. |
예
참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.
Java
자바 클라이언트 라이브러리를 사용합니다.
/* * Note: This code assumes you have an authorized Analytics service object. * See the Remarketing Audiences Developer Guide for details. */ /* * This request lists existing Remarketing Audience instances. */ try { RemarketingAudiences audiences = analytics.management().remarketingAudience().list(accountId, propertyId).execute(); /* * The results of the list method are stored in the audiences object. * The following code shows how to iterate through them. */ for (RemarketingAudience audience : audiences.getItems()) { System.out.println("Audience Id: " + audience.getId()); System.out.println("Audience Name: " + audience.getName()); // Get the linked accounts. for (LinkedForeignAccount link : audience.getLinkedAdAccounts()) { System.out.println("Linked Account ID: " + link.getLinkedAccountId()); System.out.println("Linked Account Type: " + link.getType()); } // Get the audience type. for (String linkedView : audience.getLinkedViews()) { System.out.println("Linked View ID: " + linkedView); } // Get audience type. String audienceType = audience.getAudienceType(); System.out.println("Audience Type: " + audienceType); // Get the audience definition. if (audienceType.equals("SIMPLE")) { AudienceDefinition audienceDefinition = audience.getAudienceDefinition(); // Get the inclusion conditions. IncludeConditions conditions = audienceDefinition.getIncludeConditions(); System.out.println("Condition daysToLookBack: " + conditions.getDaysToLookBack()); System.out.println( "Condition membershipDurationDays: " + conditions.getMembershipDurationDays()); System.out.println("Condition Segment: " + conditions.getSegment()); } else if (audienceType.equals("STATE_BASED")) { StateBasedAudienceDefinition stateBasedAudienceDefinition = audience.getStateBasedAudienceDefinition(); // Get the inclusion conditions. IncludeConditions includeConditions = stateBasedAudienceDefinition.getIncludeConditions(); System.out.println( "Inclusion conditions daysToLookBack: " + includeConditions.getDaysToLookBack()); System.out.println( "Inclusion conditions membershipDurationDays: " + includeConditions.getMembershipDurationDays()); System.out.println("Inclusion conditions segment: " + includeConditions.getSegment()); // Get the exclusion conditions. ExcludeConditions excludeConditions = stateBasedAudienceDefinition.getExcludeConditions(); System.out.println( "Exclusion conditions exclusionDuration: " + excludeConditions.getExclusionDuration()); System.out.println("Exclusion conditions segment: " + excludeConditions.getSegment()); } } } catch (GoogleJsonResponseException e) { System.err.println( "There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); }
2,399필리핀
PHP 클라이언트 라이브러리를 사용합니다.
/* * Note: This code assumes you have an authorized Analytics service object. * See the Remarketing Audiences Developer Guide for details. */ /* * This request lists existing Remarketing Audience instances. */ try { $audiences = $analytics->management_remarketingAudience->listManagementRemarketingAudience($accountId, $propertyId); /* * The results of the list method are stored in the audiences object. * The following code shows how to iterate through them. */ foreach ($audiences->getItems() as $audience) { $html = <<<HTML <pre> Audience Id: = {$audience->getId()} Audience Name: = {$audience->getName()} HTML; // Get the linked accounts. foreach ($audience->getLinkedAdAccounts() as $link) { $html .=<<<HTML Linked Account ID: = {$link->getLinkedAccountId()} Linked Account Type: = {$link->getType()} HTML; } // Get the linked views. foreach ($audience->getLinkedViews() as $linkedView) { $html .=<<<HTML Linked View ID: = {$linkedView} HTML; } // Get audience type. $audienceType = $audience->getAudienceType(); $html .==<<<HTML Audience Type: = {$audienceType} HTML; // Get the audience definition. if ($audienceType == "SIMPLE") { Google_Service_Analytics_RemarketingAudienceAudienceDefinition $audienceDefinition = $audience->getAudienceDefinition(); // Get the inclusion conditions. IncludeConditions conditions = $audienceDefinition->getIncludeConditions(); $html .=<<<HTML Condition daysToLookBack: = {conditions->getDaysToLookBack()} Condition membershipDurationDays: = {conditions}getMembershipDurationDays()); Condition Segment: = {conditions->getSegment()} HTML; } else if ($audienceType == "STATE_BASED") { StateBasedAudienceDefinition $stateBasedAudienceDefinition = $audience->getStateBasedAudienceDefinition(); // Get the inclusion conditions. Google_Service_Analytics_IncludeConditions $includeConditions = $stateBasedAudienceDefinition->getIncludeConditions(); $html .=<<<HTML Inclusion conditions daysToLookBack: = {$includeConditions->getDaysToLookBack()} Inclusion conditions membershipDurationDays: = {$includeConditions->getMembershipDurationDays()} Inclusion conditions segment: = {$includeConditions->getSegment()} HTML; // Get the exclusion conditions. Google_Service_Analytics_RemarketingAudienceStateBasedAudienceDefinitionExcludeConditions $excludeConditions = $stateBasedAudienceDefinition->getExcludeConditions(); $html .=<<<HTML Exclusion conditions exclusionDuration: {$excludeConditions->getExclusionDuration()} Exclusion conditions segment: = {$excludeConditions->getSegment()} HTML; } $html .= '</pre>'; print $html; } } catch (apiServiceException $e) { print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); } catch (apiException $e) { print 'There was a general API error ' . $e->getCode() . ':' . $e->getMessage(); }
Python
Python 클라이언트 라이브러리를 사용합니다.
# Note: This code assumes you have an authorized Analytics service object. # See the Remarketing Audiences Developer Guide for details. # This request lists existing Remarketing Audience. try: audiences = analytics.management().remarketingAudience().list( accountId='123456', webPropertyId='UA-123456-1' ).execute() except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error except HttpError, error: # Handle API errors. print ('There was an API error : %s : %s' % (error.resp.status, error.resp.reason)) # The results of the list method are stored in the audiences object. # The following code shows how to iterate through them. for audience in audiences.get('items', []): print 'Audience Id = %s' % audience.get('id') print 'Audience name = %s' % audience.get('name') for view in audience.get('linkedViews'): print 'linkedView = %s' % view # Get the linked accounts. for link in audience.get('linkedAdAccounts', []): print 'Link type = %s' % link.get('type') print 'Link linkedAccountId = %s' % link.get('linkedAccountId') # Get the audience type. audienceType = audience.get('type') print 'Audience type = %s' % audienceType # Get the audience definition. if audienceType == 'SIMPLE': definition = audience.get('audienceDefinition', {}) # Get the include conditions. condition = definition.get('includeConditions', {}) print 'Condition daysToLookBack = %s' % condition.get('daysToLookBack') print 'Condition membershipDurationDays = %s' % condition.get( 'membershipDurationDays') print 'Condition segment = %s' % condition.get('segment') elif audienceType == 'STATE_BASED': definition = audience.get('stateBasedAudienceDefinition', {}) # get the include conditions condition = definition.get('includeConditions', {}) print 'Condition daysToLookBack = %s' % condition.get('daysToLookBack') print 'Condition membershipDurationDays = %s' % condition.get( 'membershipDurationDays') print 'Condition segment = %s' % condition.get('segment') # get the exclude condition condition = definition.get('excludeConditions', {}) print 'Condition exclusionDuration = %s' % condition.get( 'exclusionDuration') print 'Condition segment = %s' % condition.get('segment')
JavaScript
/** * Note: This code assumes you have an authorized Analytics client object. * See the Unsampled Reports Developer Guide for details. */ /** * This request lists existing Remarketing Audiences. */ function listRemarketingAudiences(accountId, propertyId) { let request = gapi.client.analytics.management.remarketingAudience.list( { 'accountId': accountId, 'webPropertyId': propertyId, } ).then(printResults); } /** * The results of the list method are passed as the results object. * The following code shows how to iterate through them. */ function printResults(results) { if (results && !results.error) { let audiences = results.items; for (let i = 0, audience; audience = audiences[i]; i++) { console.log('Audience Id ' + audience.id); console.log('Audience name ' + audience.name); } for (let j = 0, view; audience.linkedViews[j]; j++) { console.log('linkedView ' + view); } // Get the linked accounts. let linkedAccounts = audience.linkedAdAccounts; for (let j = 0, link; link = linkedAccounts[i]; i++) { console.log('Link type ' + link.type); console.log('Link linkedAccountId ' + link.linkedAccountId); } // Get the audience type. let audienceType = audience.type; console.log('Audience type ' + audienceType); // Get the audience definition. if (audienceType == 'SIMPLE') { let definition = audience.audienceDefinition; // Get the include conditions. let condition = definition.includeConditions; console.log('Condition daysToLookBack ' + condition.daysToLookBack); console.log('Condition membershipDurationDays ' + condition.membershipDurationDays); console.log('Condition segment ' + condition.segment); } else if (audienceType == 'STATE_BASED') { let definition = audience.stateBasedAudienceDefinition; // Get the include conditions. let condition = definition.includeConditions; console.log('Condition daysToLookBack ' + condition.daysToLookBack); console.log('Condition membershipDurationDays ' + condition.membershipDurationDays); console.log('Condition segment ' + condition.segment); // Get the exclude condition let excludeCondition = definition.excludeConditions; console.log('Condition exclusionDuration ' + excludeCondition.exclusionDuration); console.log('Condition segment ' + excludeCondition.segment); } } }