You want to show your readers the posts that are most popular on your blog. If you use WordPress for maintaining your blog, you can use or must have already used plugins that show off the most popular posts. Placing such widgets help you get more traffic to your quality posts. But the wordpress plugins basically display the popular posts based on the number of comments, i.e. the more comments a blog gets, the higher is its rank on the popular posts widget. The posts that get the highest number of comments are not necessarily the posts that get the maximum number of traffic. So, what if you want to put a popular posts widget that shows the posts getting maximum number of traffic?
Certainly, this can be done and you’ll need to utilize your Google Analytics data. You cannot directly use Google Analytics resources by server side scripting as Google Analytics API is not available. But you can host your files on Google Groups and then use it to save your XML files containing your Google Analytics data.
You need to create a Google Group so head off to Google Groups page and sign in with your Gmail account. Now click on create button to create a group. Now give your group a name and select the Access Level option as Announcement only. You’ll also be provided with an email address for your group which by default is like email@example.com. You can change it as well. Anyway, this email id will be required when you’ll start sending the XML file containing your analytics data to Google Groups. Now return to the Groups homepage and click on Group Settings. You’ll need to modify some default settings. Click on Access tab and modify it as follows:
Who can view?–Anybody can view group content
Directory listing– Do not list this group
Who can join?– People have to be invited
Leave other options intact.
Now login to your Google Analytics Account. Now click on Content. Now click on “Top Content”. Now click on the email link at the top of the page. In the page that opens up, click on Schedule. Make sure the checkbox next to “Send to me” is checked. Now select the output format XML. Under the schedule dropdown menu, select Weekly. Now click on Schedule. You can also send the email manually from the “Send now” tab. You can use it once to test the email.
Now head over to your Gmail Account. If you sent the report via Send now tab, you’ll now have an email from Analytics. Now in your Gmail, create a filter for all the emails sent from Analytics. Actually you could directly send the email to Google groups email id but that would add a link midway in the email address which makes it easy for others to find the group. It is not wise to make such group public because if anyone edits the info, you’ll be putting yourself in a big mess.
To create a filter, go to Settings and click on “Filter” tab. Click on “Create a new filter”. Now, in the Subject box, type analytics yoursitename.com and do a test search. Go to Next Step and then check the boxes, Skip the Inbox and Forward it to. There enter the email address of your Google group that you just created.