I have been working on an update to my Easy Analytics plugin for WordPress and it’s almost ready. It’s a very big change in that I have added the ability to pull page stats and store them in a custom table in the WordPress database.

I have attempted to use the Google Analytics API before with limited success but this time around I used a very good PHP library called GAPI (Google Analytics PHP Interface). It is free to use and made the whole process of getting the data from GA very simple and is allowing me to focus on the plugin interface and programming options.

The catalyst for this addition to EA came from one of my clients. The project required a WordPress theme that pulled the most popular posts into a page. That in and of itself is not a big deal as there are plenty of plugins that will pull the most commented posts from the database but she wanted to use her Google Analytics stats as the basis.

I took a look around WordPress.org to see what options there were for plugins and I found that while many would connect to GA and pull the data in for use, the formatting options were limited to a sidebar widget or they would only output a list of links. I wanted more control over what each post looked like.

Currently I have the data being pulled in and displayed, There is a noticeable load time for the page so I am working on a way to cache the data in the database so the pull only happens once a day – which will reduce load times and since GA updates on a 24 hour delay anyway it’s extremely redundant to query the server every time a visitor hits the page.

I want to make the system as automated as possible so probably the first time someone hits either the Admin section or the page itself the pull will happen and the database will be updated. That way there is no need to manually hit a button to update the stats.

I will keep you posted on my progress!

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *