Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
10 posts Page 1 of 1
Today a client of ours asked if it was possible to have Google analytics stats and graphs displayed right within Couch's admin panel (a client of his wanted this actually).

I gave it a little thought and came up with this solution (I'm quoting my response verbatim)-
Hi,

That request from your client about displaying Google stats in Couch admin panel got me thinking.

Google provides an API for this purpose but its use is quite involved and will require a fair bit of effort.
I found another way that is much easier -
http://www.seethestats.com/ is a well known service that uses Google API and does the job for you.
It is meant to display Google analytics stats upon one's website but we can easily use it to show the graphs in our admin panel.

It is a free service and seems very safe -
You basically authorize it to fetch the data from Google on your behalf. No worries here as Google makes sure that your password never gets divulged and that you can cancel the service anytime by cancelling the authorization with Google.

This is how I made it work on my system -

Configure seethestats.com:
1. Create an account on http://www.seethestats.com. It will take you to Google analytics where you inform Google that you are authorizing this service to get data.

2. Let seethestats know the name of your site.

3. You will be asked to choose 6 items that you wish to get displayed (e.g. Visits, Pageviews, Unique visitors etc.) as graphs.
Important thing here is that you can chose to make the items private - that is they will not be displayed to anybody else but you.
I made all the six items private.

Once done, it will show you the graphs (in Flash) and will also display the code that you can place on your website to display the graphs there.
the code is basically just IFrames e.g.
Code: Select all
<iframe src="http://www.seethestats.com/stats/6660/Visits_a789a6666c9_ifr.html" style="width:700px;height:300px;border:none;" scrolling="no" frameborder="0"></iframe>

Copy the codes as we'll use them in the next step.

Configure Couch:
Once we have the IFrame codes, we need to find a way to get it displayed within Couch.

Couch actually has an editable region just does just this - it is type message.
It is used to output arbitrary HTML in admin panel.
This how I proceeded -
1. Create a new template e.g. stats.php. You can make it non-executable because we do not want to access it via browser using its URL..
Code: Select all
<cms:template title='Google Analytics' executable='0' >
</cms:template>

2. Create an editable region of type message and make it enclose the IFrame code we got from seethestats e.g.
Code: Select all
<cms:template title='Google Analytics' executable='0' >
   <cms:editable name='google_stats' type='message'>
      <iframe src="http://www.seethestats.com/stats/6660/Visits_a789a6666c9_ifr.html"     style="width:700px;height:300px;border:none;" scrolling="no" frameborder="0"></iframe>
   </cms:editable>
</cms:template>

3. Visit the template in your browser for Couch to pick up the changes.

That is it. This template should now show the stats in the right side of the admin panel when you click on this template.
You might want to make this the very first template listed in the left sidebar so that on opening the admin panel, this is the default template that gets shown in the right side. This can be done by setting the order parameter to a negative number. e.g -
Code: Select all
<cms:template title='Google Analytics' executable='0' order='-1'>

Try it out and let me know how it goes and if the client likes it.

Thanks and regards
Kamran


As it turned out, our client liked the solution
Thanks Kamran, everything works absolutly great.

I have posted it here hoping it might come in handy for someone else too.
Hi

I'm using NoScript and have it to forbid google-analytics.com.

Today though I installed another Firefox addon, the Ghostery.

So sometimes Ghostery tells me that it blocks googl-analytics.com, while Noscript at the same time seems to be blocking it.

Is this possible?
Hi kampyle,

I am sorry but I don't think I understood your question completely.
Could you please explain the problem a bit more?
Hi KK, I know this a bit late, but I read this over and followed the instructions, but I cannot find the iframe code. I go to the "My Webstat Pages" and there are 3 boxes. Online stats, interactive widgets, and JPG Files. After looking around in every one of them, I still couldn't find the code. Help?
If you have not already added the 'Webstat page', then do so. Click the 'Edit Webstat' button on the right under 'Online stats' to make sure everything is configured correctly. Once you do this, the code can be found by looking under 'Interactive widgets' and clicking the 'Configure widgets' button on the right.
I found my problem. Since I have just set it up, it said 0 views, so there was nothing there. I just opened the website on my laptop, and it appeared. Thanks for your help though!
Also, are the stats graphs supposed to update by themselves? Because mine have been stuck on the same graph from 3 days ago.
If you checked 'Automatically perform daily update' in the webstat setup then it should update automatically.
has anybody tried implementing a different system besides google? I'm looking at Piwik Analytics right now wondering if it could be a viable solution.
I'd rather use a software installed on my own server than cloud stuff :P incase they change stuff, as I have seen seemystats has changed a few things since i last visited them.
isn't it possible to use google analytics itself without having to go through seemystats?
I'm not primitive, My time machine just malfunctioned in your era.
cholasimmons wrote: has anybody tried implementing a different system besides google?

See what you think about https://statcounter.com/. It's a hosted service like Google Analytics, but focused more on just plain site stats and less on enterprise and ecommerce. I've used it for years and find the reporting very useful for analyzing site traffic.

They offer a full-featured free service, plus a paid tier with additional benefits.
10 posts Page 1 of 1

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 1 guest