Display number of visitors of google analytics on website

Daniel Ramirez-Escudero picture Daniel Ramirez-Escudero · Sep 30, 2013 · Viewed 36.1k times · Source

A client asked me to display the number of hits/visitors in their website. I would like to know how can you do display this.

I would insert it in my footer as displayed:

enter image description here

If not possible with google analytics, do you know of a snippet which will work? I've checked websites which offer their services but they recollect information and I would like to learn to do it myself or with google analytics. My files are PHP so maybe there is something I can do with that?

Answer

tony m picture tony m · Sep 30, 2013

You can use google anlaytics api , which can be enabled in your google api console. For knowing the number of visitors in given time period, you can utilize Core Reporting API and for knowing the current number of visitors in real time , you can use Realtime Reporting API