Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
Query Google Analytics Data API by Client Id

I am switching from Google Analytics universal to GA4. In doing so, I am now using the Google Analytics Data API. One feature I used to use was running reports based on client id. I don't see the ability to do this with the Google Analytics Data API. Can you please show me how I would accomplish the below code with the new API?

const reporting = google.analyticsreporting('v4');
const viewId = this.configService.get<string>('googleAnalytics.viewId');
const params = {
  viewId,
  user: {
    type: 'CLIENT_ID',
    userId: 123456.12312312,
  },
}
const clientEmail = this.configService.get<string>('googleAnalytics.clientEmail');
const privateKey = this.configService.get<string>('googleAnalytics.privateKey');
const scope = this.configService.get<string[]>('googleAnalytics.scope');
const jwt = new google.auth.JWT(clientEmail, null, privateKey, scope);
const request = {
  headers: { 'Content-Type': 'application/json' },
  auth: jwt,
  resource: params,
};
reporting.userActivity.search(request);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!