অনুমোদন প্রয়োজন
ব্যবহারকারীর অ্যাক্সেস আছে এমন লক্ষ্যগুলি তালিকাভুক্ত করে৷ এখন এটি চেষ্টা করুন বা একটি উদাহরণ দেখুন ।
স্ট্যান্ডার্ড প্যারামিটারগুলি ছাড়াও, এই পদ্ধতিটি প্যারামিটার টেবিলে তালিকাভুক্ত পরামিতিগুলিকে সমর্থন করে।
অনুরোধ
HTTP অনুরোধ
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/goals
পরামিতি
পরামিতি নাম | মান | বর্ণনা |
---|---|---|
পাথ প্যারামিটার | ||
accountId | string | লক্ষ্য পুনরুদ্ধার করতে অ্যাকাউন্ট আইডি। একটি নির্দিষ্ট অ্যাকাউন্ট আইডি বা ' ~all ' হতে পারে, যা ব্যবহারকারীর অ্যাক্সেস আছে এমন সমস্ত অ্যাকাউন্টকে বোঝায়। |
profileId | string | লক্ষ্য পুনরুদ্ধার করতে (প্রোফাইল) আইডি দেখুন। হয় একটি নির্দিষ্ট ভিউ (প্রোফাইল) আইডি বা '~সমস্ত' হতে পারে, যা ব্যবহারকারীর অ্যাক্সেস আছে এমন সমস্ত ভিউ (প্রোফাইল) বোঝায়। |
webPropertyId | string | লক্ষ্য পুনরুদ্ধার করার জন্য ওয়েব সম্পত্তি আইডি। হয় একটি নির্দিষ্ট ওয়েব প্রপার্টি আইডি বা ' ~all ' হতে পারে, যা ব্যবহারকারীর অ্যাক্সেস আছে এমন সমস্ত ওয়েব বৈশিষ্ট্যকে বোঝায়। |
ঐচ্ছিক ক্যোয়ারী পরামিতি | ||
max-results | integer | এই প্রতিক্রিয়াতে সর্বাধিক সংখ্যক লক্ষ্য অন্তর্ভুক্ত করতে হবে। |
start-index | integer | পুনরুদ্ধার করার জন্য প্রথম লক্ষ্যের একটি সূচক। সর্বাধিক-ফলাফল পরামিতি সহ একটি পৃষ্ঠা সংখ্যা পদ্ধতি হিসাবে এই প্যারামিটারটি ব্যবহার করুন৷ |
অনুমোদন
এই অনুরোধের জন্য নিম্নলিখিত স্কোপের মধ্যে অন্তত একটির অনুমোদন প্রয়োজন (প্রমাণিকরণ এবং অনুমোদন সম্পর্কে আরও পড়ুন )।
ব্যাপ্তি |
---|
https://www.googleapis.com/auth/analytics |
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
শরীরের অনুরোধ
এই পদ্ধতির সাথে একটি অনুরোধ সংস্থা সরবরাহ করবেন না।
প্রতিক্রিয়া
প্রতিক্রিয়া হল একটি সংগ্রহ যা প্রতিটি অনুরোধ করা লক্ষ্যের জন্য একটি লক্ষ্য সম্পদ ধারণ করে।
{ "kind": "analytics#goals", "username": string, "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.goals Resource ] }
সম্পত্তির নাম | মান | বর্ণনা | মন্তব্য |
---|---|---|---|
kind | string | সংগ্রহের ধরন। মান হল " analytics#goals "। | |
username | string | প্রমাণীকৃত ব্যবহারকারীর ইমেল আইডি | |
totalResults | integer | ফলাফলে সম্পদের সংখ্যা নির্বিশেষে প্রশ্নের জন্য মোট ফলাফলের সংখ্যা। | |
startIndex | integer | রিসোর্সের প্রারম্ভিক সূচক, যা ডিফল্টরূপে 1 বা অন্যথায় start-index ক্যোয়ারী প্যারামিটার দ্বারা নির্দিষ্ট করা হয়। | |
itemsPerPage | integer | প্রত্যাবর্তনের প্রকৃত সংখ্যা নির্বিশেষে প্রতিক্রিয়াটিতে সর্বাধিক কতগুলি সংস্থান থাকতে পারে। এটির মান 1 থেকে 1000 পর্যন্ত ডিফল্টভাবে 1000 এর মান সহ, বা অন্যথায় max-results ক্যোয়ারী প্যারামিটার দ্বারা নির্দিষ্ট করা হয়। | |
previousLink | string | এই লক্ষ্য সংগ্রহের জন্য পূর্ববর্তী পৃষ্ঠার লিঙ্ক. | |
nextLink | string | এই লক্ষ্য সংগ্রহের জন্য পরবর্তী পৃষ্ঠায় লিঙ্ক করুন। | |
items[] | list | লক্ষ্য একটি তালিকা. |
উদাহরণ
দ্রষ্টব্য: এই পদ্ধতির জন্য উপলব্ধ কোড উদাহরণগুলি সমস্ত সমর্থিত প্রোগ্রামিং ভাষার প্রতিনিধিত্ব করে না (সমর্থিত ভাষার তালিকার জন্য ক্লায়েন্ট লাইব্রেরি পৃষ্ঠা দেখুন)।
জাভা
জাভা ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
/** * Note: This code assumes you have an authorized Analytics service object. * See the Goal Dev Guide for details. */ /** * Example #1: * This example requests a list of all goals for the authorized user. */ try { Goals goals = analytics.management. goals.list("12345", "UA-12345-1","523").execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } /** * Example #2: * Retrieves all goals for all views (profiles) for the user, using a * wildcard '~all' as the profile ID. */ Goals goals = analytics.management.goals.list("12345", "UA-12345-1", "~all").execute(); /** * Example #3: * The results of the list method are stored in the Goals object. The following * code shows how to iterate through them. */ for (Goal goal : goals.getItems()) { System.out.println("Account ID: " + goal.getAccountId()); System.out.println("Property ID: " + goal.getWebPropertyId()); System.out.println("Property Internal Id: " + goal.getInternalWebPropertyId()); System.out.println("View (Profile) ID: " + goal.getId()); System.out.println("Goal Number: " + goal.getId()); System.out.println("Goal Name: " + goal.getName()); System.out.println("Goal Value: " + goal.getValue()); System.out.println("Is Goal Active: " + goal.getActive()); System.out.println("Goal Type: " + goal.getType()); System.out.println("Goal Created: " + goal.getCreated()); System.out.println("Goal Updated: " + goal.getUpdated()); if (goal.getUrlDestinationDetails() != null) { printGoalUrlDestinationDetails(goal.getUrlDestinationDetails()); } else if (goal.getVisitTimeOnSiteDetails() != null) { printGoalVisitTimeOnSiteDetails(goal.getVisitTimeOnSiteDetails()); } else if (goal.getVisitNumPagesDetails() != null) { printGoalVisitNumPagesDetails(goal.getVisitNumPagesDetails()); } else if (goal.getEventDetails() != null) { printGoalEventDetails(goal.getEventDetails()); } } /** * Example #4: * How to iterate through 'URL_DESTINATION' goals. */ private static void printUrlDestinationDetails(UrlDestinationDetails destinationDetails) { System.out.println("Goal Url: " + destinationDetails.getUrl()); System.out.println("Case Sensitive: " + destinationDetails.getCaseSensitive()); System.out.println("Match Type: " + destinationDetails.getMatchType()); System.out.println("First Step Required: " + destinationDetails.getFirstStepRequired()); if (destinationDetails.getSteps() != null) { System.out.println("Goal Steps: "); for (Steps step : destinationDetails.getSteps()) { System.out.println("Step Number: " + step.getNumber()); System.out.println("Name: " + step.getName()); System.out.println("URL: " + step.getUrl()); } } else { System.out.println("No Steps Configured"); } } /** * Example #5: * How to access a 'VISIT_TIME_ON_SITE' goal. */ private static void printVisitTimeOnSiteDetails( VisitTimeOnSiteDetails visitTimeOnSiteDetails) { System.out.println("Goal Type: VISIT_TIME_ON_SITE"); System.out.println("VISIT_TIME_ON_SITE - Comparison Type: " + visitTimeOnSiteDetails.getComparisonType()); System.out.println("VISIT_TIME_ON_SITE - Comparison Value: " + visitTimeOnSiteDetails.getComparisonValue()); } /** * Example #6: * How to access a 'VISIT_NUM_PAGES' goal. */ private static void printVisitNumPagesDetails(VisitNumPagesDetails visitNumPagesDetails) { System.out.println("Goal Type: VISIT_NUM_PAGES"); System.out.println("VISIT_NUM_PAGES - Comparison Type: " + visitNumPagesDetails.getComparisonType()); System.out.println("VISIT_NUM_PAGES - Comparison Value: " + visitNumPagesDetails.getComparisonValue()); } /** * Example #7: * How to iterate through 'EVENT' goals. */ private static void printGoalEventDetails(EventDetails eventDetails) { System.out.println("EVENT - Use Event Value: " + eventDetails.getUseEventValue()); if (eventDetails.getEventConditions() != null) { System.out.println("Goal Conditions: "); for (EventConditions conditions : eventDetails.getEventConditions()) { System.out.println("Type: " + conditions.getType()); if (conditions.getType().equals("VALUE")) { System.out.println("Comparison Type: " + conditions.getComparisonType()); System.out.println("Comparison Value: " + conditions.getComparisonValue()); } else { System.out.println("matchType: " + conditions.getMatchType()); System.out.println("expression: " + conditions.getExpression()); } } } }
পিএইচপি
পিএইচপি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
/** * Note: This code assumes you have an authorized Analytics service object. * See the Goal Developer Guide for details. */ /** * Example #1: * Requests goals for a single view (profile). */ try { $goals = $analytics->management_goals->listManagementGoals('123456', 'UA-123456-1', '7654321'); } 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(); } /** * Example #2: * Retrieves all goals for all views (profiles) for the authorized user, using a * wildcard '~all' as the view (profile) ID. */ $goals = $analytics->management_goals->listManagementGoals('123456', 'UA-123456-1', '~all'); /** * Example #3: * The results of the list method are stored in the goals object. The following * code shows how to iterate through them. */ foreach ($goals->getItems() as $goal) { $html = <<<HTML <pre> Account id = {$goal->getAccountId()} Property id = {$goal->getWebPropertyId()} Internal property id = {$goal->getInternalWebPropertyId()} View (profile) id = {$goal->getProfileId()} Goal id = {$goal->getId()} Goal name = {$goal->getName()} Goal value = {$goal->getValue()} Goal active = {$goal->getActive()} Goal created = {$goal->getCreated()} Goal updated = {$goal->getUpdated()} Goal type = {$goal->getType()} HTML; // Check for the various types of Goals. $type = $goal->getType(); if ($type == 'URL_DESTINATION') { $details = $goal->getUrlDestinationDetails(); $html .=<<<HTML Goal URL = {$details->getUrl()} Case sensitive = {$details->getCaseSensitive()} Match type = {$details->getMatchType()} First step required = {$details->getFirstStepRequired()} HTML; // Iterate through the steps foreach($details->getSteps() as $step) { $html .= <<<HTML Step number = {$step->getNumber()} Step name = {$step->getName()} Step URL = {$step->getUrl()} HTML; } } else if ($type == 'VISIT_TIME_ON_SITE') { $details = $goal->getVisitTimeOnSiteDetails(); $html .= <<<HTML Comparison type = {$details->getComparisonType()} Comparison value = {$details->getComparisonValue()} HTML; } else if ($type == 'VISIT_NUM_PAGES') { $details = $goal->getVisitNumPagesDetails(); $html .= <<<HTML Comparison type = {$details->getComparisonType()} Comparison value = {$details->getComparisonValue()} HTML; } else if ($type == 'EVENT') { $details = $goal->getEventDetails(); $html .= <<<HTML Use event value = {$details->getUseEventValue()} HTML; // Get all the event goal conditions. foreach ($details->getEventConditions() as $condition) { $html .= <<<HTML Event type = {$condition->getType()} HTML; if ($condition->getType() == 'VALUE') { // Process VALUE. $html .= <<<HTML Comparison type = {$condition->getComparisonType()} Comparison value = {$condition->getComparisonValue()} HTML; } else { // Process CATEGORY, ACTION, LABEL. $html .= <<<HTML Match type = {$condition->getMatchType()} Expression = {$condition->getExpression()} HTML; } } } $html .= '</pre>'; print $html; }
পাইথন
পাইথন ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
# Note: This code assumes you have an authorized Analytics service object. # See the Goal Dev Guide for details. # Example #1: # Requests a list of all goals for the authorized user. try: goals = analytics.management().goals().list( accountId='12345', webPropertyId='UA-12345-1', profileId='523').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())) # Example #2: # Retrieves all goals for all views (profiles) for the user, using a # wildcard '~all' as the profile ID. goals = analytics.management().goals().list(accountId='12345', webPropertyId='UA-12345-1', profileId='~all').execute() # Example #3: # The results of the list method are stored in the Goals object. The following # code shows how to iterate through them. for goal in goals_response.get('items', []): print 'Account ID = %s' % goal.get('accountId') print 'Property ID = %s' % goal.get('webPropertyId') print 'Internal Property ID = %s' % goal.get('internalWebPropertyId') print 'View (Profile) ID = %s' % goal.get('profileId') print 'Goal Number = %s' % goal.get('id') print 'Goal Name = %s' % goal.get('name') print 'Goal Value = %s' % goal.get('value') print 'Goal Active = %s' % goal.get('active') print 'Goal Type = %s' % goal.get('type') print 'Created = %s' % goal.get('created') print 'Updated = %s' % goal.get('updated') # Print the goal details depending on the type of goal. if goal.get('urlDestinationDetails'): print_url_destination_goal_details(goal.get('urlDestinationDetails')) elif goal.get('visitTimeOnSiteDetails'): print_visit_time_on_site_goal_details(goal.get('visitTimeOnSiteDetails')) elif goal.get('visitNumPagesDetails'): print_visit_num_pages_goal_details(goal.get('visitNumPagesDetails')) elif goal.get('eventDetails'): print_event_goal_details(goal.get('eventDetails')) # Example #4: # How to access a 'URL_DESTINATION' goals. def print_url_destination_goal_details(goal_details): print 'Goal URL = %s' % goal_details.get('url') print 'Case Sensitive = %s' % goal_details.get('caseSensitive') print 'Match Type = %s' % goal_details.get('matchType') print 'First Step Required = %s' % goal_details.get('firstStepRequired') print '------ Url Destination Goal Steps -------' for goal_step in goal_details.get('steps', []): print 'Step Number = %s' % goal_step.get('number') print 'Step Name = %s' % goal_step.get('name') print 'Step URL = %s' % goal_step.get('url') else: print 'No Steps Configured' # Example #5: # How to access a 'VISIT_TIME_ON_SITE' goal. def print_visit_time_on_site_goal_details(goal_details): print '------ Visit Time On Site Goal -------' print 'Comparison Type = %s' % goal_details.get('comparisonType') print 'comparison Value = %s' % goal_details.get('comparisonValue') # Example #6: # How to iterate through 'VISIT_NUM_PAGES' goals. def print_visit_num_pages_goal_details(goal_details): print '------ Visit Num Pages Goal -------' print 'Comparison Type = %s' % goal_details.get('comparisonType') print 'comparison Value = %s' % goal_details.get('comparisonValue') # Example #7: # How to iterate through 'EVENT' goals. def print_event_goal_details(goal_details): print 'Use Event Value = %s' % goal_details.get('useEventValue') for event_condition in goal_details.get('eventConditions', []): event_type = event_condition.get('type') print 'Type = %s' % event_type if event_type == 'VALUE': print 'Comparison Type = %s' % event_condition.get('comparisonType') print 'Comparison Value = %s' % event_condition.get('comparisonValue') else: # CATEGORY, ACTION, LABEL types. print 'Match Type = %s' % event_condition.get('matchType') print 'Expression = %s' % event_condition.get('expression')
জাভাস্ক্রিপ্ট
জাভাস্ক্রিপ্ট ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
/* * Note: This code assumes you have an authorized Analytics client object. * See the Goals Developer Guide for details. */ /* * Example 1: * Requests a list of all goals for the authorized user. */ function listGoals() { var request = gapi.client.analytics.management.goals.list({ 'accountId': '123456', 'webPropertyId': 'UA-123456-1', 'profileId': '7654321' }); request.execute(printGoals); } /* * Example 2: * The results of the list method are passed as the results object. * The following code shows how to iterate through them. */ function printGoals(results) { if (results && !results.error) { var goals = results.items; for (var i = 0, goal; goal = goals[i]; i++) { console.log('Account Id: ' + goal.accountId); console.log('Property Id: ' + goal.webPropertyId); console.log('Internal Property Id: ' + goal.internalWebPropertyId); console.log('View (Profile) Id: ' + goal.profileId); console.log('Goal Id: ' + goal.id); console.log('Goal Name: ' + goal.name); console.log('Goal Value: ' + goal.value); console.log('Goal Active: ' + goal.active); console.log('Goal Type: ' + goal.type); console.log('Created: ' + goal.created); console.log('Updated: ' + goal.updated); // Print the goal details depending on the type of goal. if (goal.urlDestinationDetails) { printDestinationDetails(goal.urlDestinationDetails); } else if (goal.visitTimeOnSiteDetails) { printComparisonDetails(goal.visitTimeOnSiteDetails); } else if (goal.visitNumPagesDetails) { printComparisonDetails(goal.visitNumPagesDetails); } else if (goal.eventDetails) { printEventDetails(goal.eventDetails); } } } } function printDestinationDetails(details) { console.log('Goal URL: ' + details.url); console.log('Case Sensitive: ' + details.caseSensitive); console.log('Match Type: ' + details.matchType); console.log('First Step Required: ' + details.firstStepRequired); // Iterate through the steps. var steps = details.steps; if (steps) { for (var i = 0, step; step = steps[i]; i++) { console.log('Step Number: ' + step.number); console.log('Step Name: ' + step.name); console.log('Step URL: ' + step.url); } } else { console.log('No Steps Configured.'); } } function printComparisonDetails(details) { console.log('Comparison Type: ' + details.comparisonType); console.log('Comparison Value: ' + details.comparisonValue); } function printEventDetails(details) { var conditions = details.eventContitions; if (conditions) { for (var i = 0, condition; condition = conditions[i]; i++) { console.log('Condition Type: ' + condition.type); if (condition.type == 'VALUE') { console.log('Comparison Type: ' + condition.comparisonType); console.log('Comparison Value: ' + condition.comparisonValue); } else { console.log('Match Type: ' + condition.matchType); console.log('Expression: ' + condition.expression); } } } }
এটা চেষ্টা করুন!
লাইভ ডেটাতে এই পদ্ধতিতে কল করতে এবং প্রতিক্রিয়া দেখতে নীচের APIs এক্সপ্লোরার ব্যবহার করুন। বিকল্পভাবে, স্বতন্ত্র এক্সপ্লোরার ব্যবহার করে দেখুন।