उन रीमार्केटिंग ऑडियंस को सूचीबद्ध करता है, जिनका ऐक्सेस उपयोगकर्ताओं के पास है. एक उदाहरण देखें.
अनुरोध करें
एचटीटीपी अनुरोध
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/remarketingAudiences
पैरामीटर
पैरामीटर का नाम | वैल्यू | जानकारी |
---|---|---|
पाथ पैरामीटर | ||
accountId |
string |
फिर से हासिल करने के लिए रीमार्केटिंग ऑडियंस का खाता आईडी. |
webPropertyId |
string |
फिर से हासिल करने के लिए रीमार्केटिंग ऑडियंस की वेब प्रॉपर्टी आईडी. |
क्वेरी के वैकल्पिक पैरामीटर | ||
max-results |
integer |
इस जवाब में शामिल करने के लिए रीमार्केटिंग ऑडियंस की ज़्यादा से ज़्यादा संख्या. |
start-index |
integer |
पुनर्प्राप्त करने वाली पहली इकाई का इंडेक्स. इस पैरामीटर का इस्तेमाल, ज़्यादा से ज़्यादा नतीजों वाले पैरामीटर के साथ-साथ, पेजों को क्रम में लगाने के तरीके के तौर पर करें. |
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 ] }
प्रॉपर्टी का नाम | वैल्यू | जानकारी | नोट |
---|---|---|---|
kind |
string |
संग्रह का प्रकार. | |
username |
string |
पुष्टि किए गए उपयोगकर्ता का ईमेल आईडी | |
totalResults |
integer |
क्वेरी के नतीजों की कुल संख्या, भले ही जवाब में कितने भी नतीजे हों. | |
startIndex |
integer |
रिसॉर्स का शुरुआती इंडेक्स. यह डिफ़ॉल्ट रूप से एक होता है या किसी और तरीके से, शुरुआती इंडेक्स क्वेरी पैरामीटर से तय किया जाता है. | |
itemsPerPage |
integer |
जवाब की संख्या ज़्यादा से ज़्यादा इतने संसाधन हो सकते हैं कि रिस्पॉन्स में कितने संसाधन शामिल हैं. इसकी वैल्यू 1 से 1,000 के बीच होती है. इसमें डिफ़ॉल्ट रूप से 1,000 की वैल्यू होती है. इसके अलावा, ज़्यादा से ज़्यादा नतीजों वाले क्वेरी पैरामीटर से तय की जाती है. | |
previousLink |
string |
इस व्यू (प्रोफ़ाइल) के संग्रह के लिए, पिछले पेज का लिंक. | |
nextLink |
string |
इस रीमार्केटिंग ऑडियंस संग्रह के लिए अगले पेज का लिंक. | |
items[] |
list |
रीमार्केटिंग ऑडियंस की सूची. |
उदाहरण
ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).
Java
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()); }
PHP
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
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); } } }