0

I am trying to get all data from my Google Analytics account to a database using their Reporting API v4. In the below request and response, I see a number in the values attribute. I want to get member specific data for that number? For example, value is 65 for dimension 20130101. I want to get data of those 65 members that accessed my website that day (2013-01-01 - the specified dimension in the request). Any data that GA has will suffice. For example, the Gender of those 65 members, their session Id, age etc.

Google Analytics Reporting API Request:

{
"reportRequests": [
    {
        "viewId": "345",
        "dateRanges": [
            {
                "startDate": "daysAgo",
                "endDate": "yesterday"
            }
        ],

        "metrics": [
            {
                "expression": "ga:users"
            }
        ],
        "dimensions":[
            {
              "name":"ga:date"
            }
        ]
    }
]

}

Response

{
"reports": [
    {
        "columnHeader": {
            "dimensions": [
                "ga:date"
            ],
            "metricHeader": {
                "metricHeaderEntries": [
                    {
                        "name": "ga:users",
                        "type": "INTEGER"
                    }
                ]
            }
        },
        "data": {
            "rows": [
                {
                    "dimensions": [
                        "20130101"
                    ],
                    "metrics": [
                        {
                            "values": [
                                "65"
                            ]
                        }
                    ]
                },
                {
                    "dimensions": [
                        "20130102"
                    ],
                    "metrics": [
                        {
                            "values": [
                                "69"
                            ]
                        }
                    ]
                },
                {
                    "dimensions": [
                        "20130103"
                    ],
                    "metrics": [
                        {
                            "values": [
                                "48"
                            ]
                        }
                    ]
                }
            ],
            "totals": [
                {
                    "values": [
                        "490"
                    ]
                }
            ],
            "rowCount": 3,
            "minimums": [
                {
                    "values": [
                        "44"
                    ]
                }
            ],
            "maximums": [
                {
                    "values": [
                        "94"
                    ]
                }
            ],
            "isDataGolden": true
        }
    }
]

}

Doe
  • 379
  • 3
  • 14

1 Answers1

1

Google Analytics reporting api don't provide single rows reports, that means that all the data that you can collect is gruped by the dimension.

In that case, if you want to retrieve al this data in a single report, you have to implement a custom dimension to a users level to identify each one, one option is send the client id (the _ga cookie) to the platform and add that dimension

Here is a good post of how to implement this https://www.simoahava.com/analytics/add-clientid-to-custom-dimension-gtag-js/

Have in mind that you can expect others on the reports in that case, due the high cardinality.

https://support.google.com/analytics/answer/1009671?hl=en

For premium users you can export the data via BigQuery

Greetings

Kemen Paulos Plaza
  • 1,560
  • 9
  • 18
  • So when I request data in the custom dimension via the reporting API, my data is going to be sampled? – Doe May 21 '18 at 14:46
  • not sampled, but you can see a max of 50k of unique values, after that the upcoming values will be displayed as (Other), take in consideration that this is not a solution, this is a workaround, Google Analytics is not designed as a tool to get grouped data not individuals study subject. – Kemen Paulos Plaza May 22 '18 at 13:50
  • I know the no.of users on my mobile app are less than 50K each week. So if I filter by week, should I expect to see all member data without the (Other) entries? – Doe May 23 '18 at 15:00
  • yes, if you have more will only see the first 50k rows, if others appears just reduce the time windows to make the (Others) dissapears – Kemen Paulos Plaza May 25 '18 at 11:07