How to Authenticate to Google, Adobe & Matomo APIs

🔍 Intro

Let’s say you want to plug into your analytics tool — Google Analytics 4, Adobe Analytics, or Matomo — and pull data through their API.
The naive approach?

“I’ll just call the API endpoint and get the data.”

❌ Not gonna happen.

➡️ No serious API gives you access without authentication.
You need to prove who you are — and what you’re allowed to do.

Let’s break down how authentication works for each major platform.


🟢 Google Analytics API (GA4 Data API or Reporting API v4)

Auth methods:

  • OAuth2 (for user-driven flows)
  • Service Account + JWT (for server-to-server / automation use cases)

Typical flow with a service account:

  1. Create a Google Cloud project
  2. Enable the Analytics Data API
  3. Create a Service Account
  4. Grant it access to your GA4 property as a Viewer
  5. Download the JSON key file
  6. Use a library like google-auth to generate a token
curl -X POST https://analyticsdata.googleapis.com/v1beta/properties/XXXXX:runReport \
-H "Authorization: Bearer ya29.a0AfH6SMXXXXX" \
-H "Content-Type: application/json" \
-d @body.json

📘 Official doc: https://developers.google.com/analytics/devguides/reporting/data/v1

🔵 Adobe Analytics API (via Adobe I/O)

Auth methods:

  • OAuth 2.0 with JWT or Device Auth
  • You’ll need: client_id, client_secret, technical_account_id, org_id, private_key

JWT flow:

  1. Set up a project in the Adobe Developer Console
  2. Add the Analytics API to the project
  3. Configure access (product profiles, sandboxes, scopes)
  4. Locally generate a signed JWT using your private key
  5. Exchange it for an access token via Adobe IMS
curl -X POST https://ims-na1.adobelogin.com/ims/exchange/jwt \
  -d "client_id=XXXX&client_secret=XXXX&jwt_token=XXXXX"

📘 Official doc: https://experienceleague.adobe.com/docs/analytics-apis/

🟣 Matomo

Auth method:

  • One simple token: token_auth
  • Can be passed as:
    ‣ Query param
    ‣ POST body
    ‣ HTTP header

Example:

curl "https://matomo.yourdomain.com/index.php?module=API&method=VisitsSummary.get&idSite=1&period=day&date=today&format=JSON&token_auth=your_token"

📘 Official doc: https://developer.matomo.org/api-reference/reporting-api

🔐 Tips & Takeaways

Want to call an analytics API?

‣ First step: secure your auth setup
‣ Never hardcode your keys in public repos
‣ Handle token expiration properly (most expire within 1 hour)

Authentication isn’t a blocker.
👉 It’s the entry ticket to reliable, secure data access.

Laurent Fidahoussen
Laurent Fidahoussen

Ads & Tracking & Analytics & Dataviz for better Data Marketing and boost digital performance

25 years in IT, 10+ in digital data projects — I connect the dots between tech, analytics, reporting & media (not a pure Ads expert—but I’ll make your campaigns work for you)
- Finding it hard to launch, track, or measure your digital campaigns?
- Not sure if your marketing budget is working—or how your audiences behave?
- Messy tracking makes reporting a nightmare, and fast decisions impossible?
- Still wrestling with Excel to build dashboards, without real actionable insights?

I can help you:
- Launch and manage ad campaigns (Google, Meta, LinkedIn…)
- Set up robust, clean tracking—so you know what every euro gives you back
- Build and optimize events: visits, product views, carts, checkout, purchases, abandons
- Create dashboards and analytics tools that turn your data into real growth drivers
- Streamline reporting and visualization for simple, fast decisions

Curious? Let’s connect—my promise: clear, no jargon, just better results.

Stack:
Ads (Google Ads, Meta Ads, LinkedIn Ads) | Analytics (Adobe Analytics, GA4, GTM client & server-side) | Dataviz (Looker Studio, Power BI, Python/Jupyter)

Articles: 28