I need to fetch different metrics like Total Clicks, Impressions, Campaign performance tracking based on a date range. I'm unable to understand the documentation, it's very confusing.

Google Analytics has a simple structure like below to fetch data

  json: { reportRequests: [
                                           {
                                             viewId: pageid,
                                             dateRanges: [
                                               {
                                                 startDate: fromDate,
                                                 endDate: toDate
                                               },
                                               {
                                                 startDate: compFromDate,
                                                 endDate: compToDate
                                               }
                                             ],
                                             dimensions: [
                                              {
                                                name:'ga:date'
                                              }],
                                             metrics: [

                                               {
                                                 expression: 'ga:avgScreenviewDuration'
                                               },
                                               {
                                                 expression: 'ga:screenviews'
                                               },
                                               {
                                                 expression: 'ga:screenviewsPerSession'
                                               },
                                               {
                                                 expression: 'ga:pageviews'
                                               },
                                               {
                                                 expression: 'ga:pageviewsPerSession'
                                               },
                                               {
                                                 expression: 'ga:transactionRevenuePerSession'
                                               },
                                               {
                                                 expression: 'ga:revenuePerTransaction'
                                               },
                                               {
                                                 expression: 'ga:transactions'
                                               },
                                               {
                                                 expression: 'ga:goalConversionRateAll'
                                               },
                                               {
                                                 expression: 'ga:goalValueAll'
                                               }

                                             ]

                                           }
                                         ]}

It has a simple concept of dimensions and metrics to fetch data.

Is there some similar guide for Google Ads API.

I'm able to fetch the AccessToken for making API calls. I know that the base URL for API requests is https://googleads.googleapis.com/v1/customers/{customer_id}

If someone can guide me with fetching 1 metric, that would really be helpful.

0 Answers