3

I'm trying to get data about visitors of my site and filter it by client id(_gid or ClientId) in the real time. Example of id: 875500683.1564061354

Firstly I tried to use the GA Reporting API to get and filter data(check code below). It works good and I receive data only for necessary visitor but it has some delay before it can be possible to get info from the Analytics(7-15 min after visitor arrives site) and it is not good for me. So next I tried to use realtime reporting API, but I didn't find something like ga:clientId in the API parametrs to filter data. I serched in the Google Analytics documentation but didn't find way to filter data by visitors in the Realtime Reporting API. Is there any way to get data in realtime and filter it by client id?

//using Reporing API
analytics.data().ga()
                .get("ga:" + viewId, "30daysAgo", "today",
                        "ga:pageValue, ga:sessions")
                .setDimensions("ga:browser, ga:campaign")
                .setStartIndex(1)
                .setFilters("ga:clientId==" + clientId)
                .setMaxResults(10000)
                .execute();
Vadim
  • 31
  • 1

0 Answers0