Ahmad Magdy
Ahmad Magdy

Reputation: 13

Google analytics integration with Java api

I want to integrate google analytics with my Spring boot API. Whenever I send an event request, I always get forbidden in google analytics response. the request I'm using is

http://www.google-analytics.com/mp/collect?api_secret={API_SECRET}&measurement_id={MEASUREMENT_ID}

with a payload of:

{
  "client_id": "{CLIENT_ID}",
  "timestamp_micros": "1652351615578000",
  "non_personalized_ads": false,
  "events": [
      {
          "name": "test"
      }
  ]
}

I got the API_SECRET and MEASUREMENT_ID from analytics webpage and the CLIENT_ID in the payload from google analytics javascript library I don't know what I'm missing or doing wrong .

Upvotes: 0

Views: 945

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117254

The correct endpoint for the google analytics measurement protocol ga4 is

https://www.google-analytics.com/mp/collect

You are using

HTTP.

Upvotes: 0

Related Questions