We are using google analytics on our website to record the statistics. however, we need to show the total visits is it possible to show from google analytics API? TIA
Im not sure where you want to show the total visits but if its on your website you need to remember a few things about the Google Analytics api.
The first being that there is a data latency which means that it takes between 24 -48 hours for your data to complete processing. If you attempt to request say the current visits for today then the number will not be correct. You could request the number of vists for say three days ago and get back a number that is stable.
The other issue you are going to have is with quota. If you intend to load this from the API everytime a user visits your website they you will quickly run out of quota as you can only make 10k requests against a view in a single day so depending upon how many times this page is loaded this may not work for you.
An idea would be to load the data once at night and store the data in your database some place and then load from that as then you are only making a single request to the api and are unlikely to run out of quota.