Using the New Google Analytics API to Get Most Popular Pages

Using the New Google Analytics API to Get Most Popular Pages

Google Analytics 4 is here, and with it a new Node.JS API. Let’s take a look at using it to get our most popular pages. Using the New Google Analytics API to Get Most Popular Pages. Then we'll need to activate Google Analytics API for our project: Next, we'll create a new client ID.

It’s often useful to get a list of the most popular pages on your website or app, either to feed into analytics, or to build UI elements which show users what your most popular content is. In times gone by, a hit counter might be used to track your most popular pages.

However, in the modern world, it’s much easier to use the Google Analytics API. Since Google has recently updated Analytics to ‘Google Analytics 4’, and also changed the Javascript API, I thought I’d write a guide on how I’ve done this on my website, Fjolt. For this tutorial I’ll be using Node.JS.

Note: this will only work with the new Google Analytics 4, and will NOT work with previous versions of Google Analytics.

Google Analytics API

As mentioned, recently Google has upgraded us all to a new version of Google Analytics, simply known as ‘Google Analytics 4’. The data model is completely different from older versions of Google Analytics, and Google has used this opportunity to standardise the API for it to align with what it uses for its other services.

This API is documented, but it is experimental, so it may change. However, I imagine the high level concepts used here will remain the same, and the data model for Google Analytics itself certainly will.

Step 1: Create a Google Service Account

Step 3: Get the Analytics Data

Step 4: Create a UI

Step 5: Relax

google javascript web-development software-development

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

Hire Dedicated JavaScript Developers -Hire JavaScript Developers

Hire dedicated JavaScript Developers who are proficient in AngularJS, ReactJS, NodeJS, & VueJS frameworks. Get flexible hiring models as per your business requirements.

JS Development Company India | JavaScript Development Services

Best JavaScript web app development company in India, PixelCrayons provides full stack JS development & maintenance. 16+ Yrs Exp., 60% less cost, Strict NDA

How to Hire an Outsourcing Software Development Company

While outsourcing **[custom software development services]( "custom software development services")** for all your needs, you can add ample interests to the business by giving access to skilled expertise resulting in the...

ERP Software Services, POS Software Services , Application Development

Vinew Technologies focused majorly over ERP Software services and POS Software services, Web & Application development services & Woo commerce and Wordpress easy-to-use, multipurpose social media plugin for WordPress.