One of our very large customers gave us a call last Friday and told us that a stat counter that they were using on one of their websites suddenly stopped working. That stat counter was very important for them, since it was used by their potential advertisers to know how much page impressions they will get should they choose to advertise on the website. Clearly, they needed a solution and they needed it immediately!
We sent them a list of 3rd party stat counter widgets that can be easily embedded in a Custom HTML Joomla module. But they told us that they prefer a module for them that will get the data directly from their Google Analytics account. Clearly, they wanted to use something solid because they didn’t want to use another 3rd party widget that may stop working all of a sudden.
Hmmm – we thought! We haven’t done this before but if it’s doable, then we’ll certainly do it!
So we made a research, and we discovered that Google has an API to access Google Analytics‘ data. That was exactly what we wanted (a practical use of the API can be found here). So, here’s what we did:
- We created a module that will take the username and the password for the Google Analytics account, as well as the Profile ID for the site in question. The module also had some other parameter such as:
-
The period for which the company wishes to display the data for (e.g. current month, last 31 days, current year, etc…).
-
The display format of the module.
-
Whether or not the data coming from Google Analytics should be cached (if we cache the results then this means we won’t have to fetch the data from Google every time someone visits a page). Caching was enabled by default.
-
-
We then ensured that the module would connect to Google and fetch the results for the specific website and for the specific time period given.
-
That was it!
Of course, we did face many challenges when creating this module, namely because it’s hard to find some coherent and up-to-date documentation on how to do this. But, on the bright side, the work was definitely worth it, this is because:
- First and foremost, our client was happy!
-
The website no longer depends on other websites to display its traffic data – it now only depends on Google, which probably has the most stable infrastructure in the Internet world. In other words, the client no longer has to worry about using a widget from a 3rd party company that is going to disappear in a week, or whose servers constantly experience “technical difficulties”.
-
The client is no longer forced to display ads on his stat widget or to pay a monthly/yearly fee to display that widget. Additionally, the client is now confident that the module they’re using to display the traffic data is not secretly spying on their website and stealing keywords. (Quick note: All stat counter widgets secretly spy on your website and steal keywords – that’s why their basic plan is free.)
-
The data being displayed on the client’s website is consistent with the data in their Google Analytics account.
If your company wants to display data directly from Google Analytics on the frontend of its Joomla website and you would like some help in doing so, then all you have to do is to contact us. We’ve already done this before and we know we can do it for you. We’ll do it fast, professionally, and for a very reasonable fee.