googleanalytics / ga-dev-tools

A showcase of demos and tools built with the various Google Analytics APIs and Libraries.
https://ga-dev-tools.web.app/
Other
1.39k stars 559 forks source link

Latitude / Longitude GA4 #962

Open PaulieScanlon opened 2 years ago

PaulieScanlon commented 2 years ago

Missing ga:latitude,ga:longitude in GA4 API

Describe the bug Hi team, in the UA API i used to be able to query for ga:latitude,ga:longitude. Was this removed from GA4?... I miss it. It was cool and allowed me to plot positions of my users around a sweet ass 3D globe. I'd like to do the same thing with my new GA4 data.

Example of sweet ass globe here 👇 https://paulie.dev/dashboard/

elfilalime commented 1 year ago

Needed also

keke78ui9 commented 1 year ago

Base on this document from GA4, if enable Granular location and device data collection should see the Latitude/Longitude, I had enabled but don't see any Latitude/Longitude data, (checked at the event_parameters at BQ).

PaulieScanlon commented 1 year ago

@keke78ui9 Ok, i tried it to. I've enabled granular collection.

I do see the city and that is documented as a valid dimension in this table but latitude and longitude aren't listed.

The page you referenced does say this information should be available though... Maybe latitude and longitude are only available through the web UI, and not through the API?

    const [test] = await analyticsDataClient.runReport({
      property: `properties/${process.env.GOOGLE_GA4_PROPERTY_ID}`,
      dateRanges: [
        {
          startDate: '30daysAgo',
          endDate: 'today'
        }
      ],
      dimensions: [
        {
          name: 'country'
        },
        {
          name: 'city'
        },
        {
          name: 'latitude' // <= This causes an error
        }
      ],
      metrics: [
        {
          name: 'totalUsers'
        }
      ]
    });
jmcglone commented 1 year ago

Any updates on this @PaulieScanlon ? I'm trying to update a similar usage map application to work with the GA4 API and just realizing the lat/long values aren't available. Wondering if you came up with any workarounds to get the lat/long data.

Example: https://publishing.umich.edu/our-reach

jeffdyke commented 1 year ago

Bump

InnovexIT-Syl commented 1 year ago

Any Update on this?

PJKW999 commented 1 year ago

Any updates? As not available from the Web UI either.

donaldinou commented 1 year ago

hi, Anyone got a solution for this?

rmzonl commented 11 months ago

Hello. Is there anyone who has found a solution for this issue? I tried to get the user’s coordinates with customDimension but I couldn’t succeed. Can someone please help me?

Silaszur commented 9 months ago

bump

PaulieScanlon commented 8 months ago

I don't think this is every gonna make it into to GA4. I rolled my own solution in the end: Roll Your Own Analytics With Astro, Vercel Edge Functions and Neon.

It's how all the analytics on my /dashboard work.

Silaszur commented 8 months ago

I don't think this is every gonna make it into to GA4. I rolled my own solution in the end: Roll Your Own Analytics With Astro, Vercel Edge Functions and Neon.

It's how all the analytics on my /dashboard work.

Thanks for the reply, and for your blog. It is such a shame that they removed this functionality but keeping the city dimension (Maybe they want us to use their geocoding api). They could have just given the coordinates of the city at this point.