I am designated to produce a WordPress wordpress plugin that shows recent visits graph under each publish in WordPress. I am battling using the authentication from the data and general structure of wordpress plugin. My first question could be what is the best method to authenticate with Google API with this type of task? I had been considering the AuthSub however i cant understand the idea of next parameter within the query. It ought to be the website landing page after authorization, but how do i have great results dynamically with the different posts? In OAuth i am getting a little lost in terminology.
Second real question is how frequently if the Google API be queried for that results. I am talking about could it be rational to create more compact request each time customer opens a webpage or possibly its rater optimal to download the information for that pages once and it in local xml and refresh it on some times?
As a concept of the wordpress plugin overall structure i believed of creating a php file which may create the graph from the GA feed and would get it done then when known as from publish hook via ajax. This is controlled by passing parameters from the publish to that particular php file.
Would that structure seem sensible or there's an simpler method to preform the job?
I'd really appreciate if a person pointed me in right direction particularly in authentication problem.
The most crucial factor to complete first would be to construct your design. You do not want the consumer of the site to authenticate around the GA API. While he does not get access to your computer data. So you will need to login with your personal qualifications around the after sales. And merely cache the metrics you need to display on screen. So, in the user perspective, there is no method to know if you are using Google Statistics or other web statistics product.
Since you are dealing with Wordpress and you will need to perform the data pull around the after sales you most likely wish to accomplish that using PHP.
You need to have a look only at that PHP library. http://code.google.com/p/gapi-google-analytics-php-interface/
Despite the fact that it isn't google formally supported it's very good and also you will not need to bother about the entire process of authentication.
It does not seem sensible to question GA each time the consumer visits your website. Besides affecting the burden heavily the GA API has some latency and GA isn't a real-time tool. The information quality in your GA data is dependent how much data you receive. If you're a small blog it will take 2-4 hrs to process the information. If you are a large blog it will take as much as 48h. So for your reason I'd query the API every 4 hrs approximately and merely cache the information for your pages. Whenever you render the page it's only a matter of setting it up in the cache/db.
To plot that data you will find lots of options around there. I'd suggest you to begin with Google Chart Tools.