google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

organicGoogleSearch[....] metrics required dimension

Open benjamingiraud opened this issue 3 years ago • 1 comments

Hello, I'm currently testing the BestaAnalyticsDataClient and had a question about the origanicGoogleSearch... (organicGoogleSearchAveragePosition, organicGoogleSearchClickThroughRate, organicGoogleSearchClicks, organicGoogleSearchImpressions) metrics.

Here's the code :

    const [response] = await analyticsDataClient.runReport({
        property: `properties/${propertyId}`,
        dateRanges: [
            {
                startDate: '2020-10-11',
                endDate: 'today',
            },
        ],
        dimensions: [
          {
            name: '????',
          },
        ],
        metrics: [
            // {
            //     name: 'activeUsers',
            // },
            {
                name: 'organicGoogleSearchAveragePosition',
            }
        ],
    });

Here's the error code : Error: 3 INVALID_ARGUMENT: The dimensions and metrics are incompatible

I can't seem to find the required dimension to get the data (I'd like to see the data we get from the analytics google search section's default dashboard : the request search terms and its datas).

Have a good day !

benjamingiraud avatar Nov 15 '22 15:11 benjamingiraud

Benjamin,

Depending on what you are trying to do, googleAdsQuery, sessionGoogleAdsQuery, firstUserGoogleAdsQuery seem like a good match. Please see the Data API schema for the complete list of supported fields and dimensions. Also, it might be convenient to create a custom report using the Google Analytics UI first, validate your results and then translate the query into a Data API call.

ikuleshov avatar Feb 23 '23 23:02 ikuleshov