My Google Analytics module - with dashboard graph

edited September 2011 in Share
Hello there,
i noticed the FuelCMS Google Analytics module provided here https://github.com/daylightstudio/FUEL-CMS-Modules-Pack doesn't really work (at least here...)
So i took inspiration from PyroCMS's builtin Google Analytics module and ported it to FuelCMS.
If anyone's interested i'll put it up for you to download - let me know
UPDATE You can find it on GitHub : https://github.com/pierlo-upitup/google_analytics

Basically it allows you to see the last month's page views / unique visits graphed by jQuery Flot.
Here's a screenshot


Note to admin: may I suggest to have forum category for the community to share useful modules? That would be so awesome, really!

Comments

  • edited 11:27AM
    Hi pierlo, I haven't actually tried the Modules-pack yet, but I wanted to try it solely for the GA dashboard. Could you let Admin know what doesnt work so that he can get it fixed?
  • edited 11:27AM
    Pierlo, wow!... Are you willing to share that? I'd be happy to replace the one in the module pack with that because all it does is take you to Google analytics without logging in (it's pretty lame). Send me a note if you are.

    There is a share category in the forum. However, we don't have an infrastructure to better facilitate the sharing of those modules. We've been talking about that here for a while, but...well we haven't gotten to it.
  • edited 11:27AM
    Yes, sorry - it's not that the module didn't work, it's just that it's not that useful...
    admin, i've sent you a PM about the module.
    Talking about the module sharing platform, an idea could be to have an open collaboration of coders from the community work on it... :)
    Or maybe just a moderated sticky post of modules submitted by the community could be enough for now
  • edited September 2011
    yea like it. i also implemented ga into fuel.

  • edited 11:27AM
    Hey webcam!
    yours is a little more advanced, I planned on adding that extra functionality as well for my module - but if you feel like sharing yours... :)
  • edited 11:27AM
    A moderated sticky post for modules is a good idea until we get something better running.

    I think a community driven sharing platform is a great idea, and would happily help where is needed. Truthfully, it would probably be a while before we at Daylight would be able to develop something to fit the communities needs so this would probably be a better solution.
  • edited 11:27AM
    I've released it on GitHub
    https://github.com/pierlo-upitup/google_analytics

    Hope you find it useful.
    I'm planning to add some extra features to it - basically the same stuff @webcam's own GA module as shown in the picture above and possibly on-the-fly timeframe adjustment.
  • edited 11:27AM
    It's funny you don't mention this in the README since you asked the question yourself in another thread, but for people who just tried to install this.

    - This module is designed for the dashboard. So you need to add it do the 'dashboards' key in your MY_fuel.php config, eg

    $config['dashboards'] = array('google_analytics');

    Since you're overriding the fuel default, if you want those back, it looks like

    $config['dashboards'] = array('google_analytics','fuel','backup');
  • edited 11:27AM
    Thanks! :)
  • edited 11:27AM
    I've finally remembered to update the readme, thanks for the hint @tw12lve
  • edited 11:27AM
    BTW... just used the module for a project we had and was great!
  • edited 11:27AM
    Glad i can give something back, FuelCMS has been my weapon of choice for about a year now!
  • edited 11:27AM
    Has anyone updated this? It appears that GA has changed so much that the script isn't working correctly anymore :(

    Plus using the Tracker ID instead of the profile ID:

    The Profile ID location is in the URL when you're logged in:
    For the NEW VERSION analytic page it is the number at the end of the URL starting with p https://www.google.com/analytics/web/#home/aXXXXXXXXwXXXXXXXXpXXXXXXXX/

    I tried using it, but the script still failed. Gives an error connecting to GA.

    Looks like GA updated their API to a new version which isn't compatible with the older one. Not sure if that's the cause of the errors.
  • edited 11:27AM
    That's weird – it's still working fine for me...? maybe you didn't set it up correctly?
    You need to log in on your Analytics account, click on the profile for the domain, and look at the URL. Simply grab that number after the 'p' at the end and paste it under

    $config['google_analytics']['profile_id']
    inside google_analytics/config/google_analytics.php

    if you did that and it still fails, are you sure the password provided is the right one? And what about the tracking code ?

    http://support.google.com/analytics/bin/answer.py?hl=en&answer=1032385
  • edited 11:27AM
    I've just tried my GA module installs for v0.93 & v1.0 and both seem to be working fine
  • edited 11:27AM
    Ahh... got it! I thought I read it needed 9 digits... but it's only the 8 numeric digits it needs.
    SMH :)
  • edited 11:27AM
    i just tried installing this on a fresh install of fuelcms 1.0... it would be good to mention that you need to add 'google_analytics' within $config['modules_allowed']. also, you will need to add $config['dashboards'] = array('fuel','google_analytics'); since it doesn't include it in the config file by default. after that.. it worked like a charm. thanks for the addition!
  • edited 11:27AM
    As an FYI, I believe the README on GitHub mentions adding to the $config['dashboards'] config:
    https://github.com/pierlo-upitup/google_analytics

    Also, if you use FUEL's command line tool to install, it will automatically add it to the $config['modules_allowed'].
    php index.php fuel/installer/install google_analytics
  • edited 11:27AM
    Update - I've recently installed this module in another site, and even when the Google account is made to accept "less secure apps" it still fails. Does the authentication need updating?
  • edited 11:27AM
    I'm not sure at this point and probably won't get to digging into and fixing the problem for a while. So if anyone else has the time to dive in, I'd be happy to assist. Here are a few links to get started down the right track.
    https://developers.google.com/analytics/devguides/reporting/core/v2/gdataProtocol
    https://developers.google.com/gdata/articles/using_cURL
    https://developers.google.com/gdata/docs/developers-guide

    In my testing of it, it seems to get hung up on the second CURL request to retrieve the visitor data (or any data). I'm able to get the Authentication CURL request, but the second one to retrieve the data just hangs. Could be a change in how Google handles it.

    Updating the Analytics library didn't help either:
    https://github.com/pyrocms/pyrocms-ci/blob/22c5b2bedf4b7a059bb4b58518f95e8070750512/system/cms/libraries/Analytics.php
  • edited 11:27AM
    Some good news. After a day or 2 the graph started working, but I'm not sure why - maybe changing Google's settings takes a while to take effect?
  • edited 11:27AM
    Hmmm... well look at that... it's working again for me too. Thanks for the update.
  • edited January 2016
    Any plans to update this to OAuth2? I was researching how to do it for my application, but I don't know how (since I have zero experience with Google API). Seems like it would mean we need to rewrite the whole module...

    The embed API seems like a simpler alternative: https://developers.google.com/analytics/devguides/reporting/embed/v1/
  • edited 11:27AM
    That embed API looks interesting. If you do plan on implementing perhaps your own Dashboard with this, I'd love to see it.
Sign In or Register to comment.