We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New extension: Google Analytics Panel

Development and Programming

Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

The creatively-named Google Analytics Panel adds an overview of your site’s Google Analytics statistics to a panel on the ExpressionEngine control panel home screen. The panel displays quick stats for Today and Yesterday (visits, pageviews, average pageviews per visit, and average visit length), with increased stats for the past 31 days (visits, pageviews, average pageviews per visit, average visit length, bounce rate, percentage of new visits, top content and top referrers). The 31-day stats also include sparklines to visualize site activity. It’s all very pretty really.

Installation

Upload the Analytics panel extension and language file to /system/extensions/ and /system/language/english/ respectively. Then upload the included /lib/analytics_panel folder to your /system/lib/ directory.

Activate the extension, then visit the Google Analytics Panel settings screen. Enter your Google Analytics username and password and click Submit. Load the settings screen again, and choose the profile you wish to display on the home screen.

The Google Analytics panel will now be available on the My Account -> Customize Control Panel -> Control Panel Homepage screen for each user, and can be set to display in either the left or right column, and ordered just like the default homepage panels.

Now load your home screen, wait for a few seconds (cuz the API is kinda slow), and cry/smile at how un/popular your site is.

Download it from GitHub

Google Analytics Panel has been tested with ExpressionEngine 1.6.8, and requires PHP 5.

Note: if you’re currently using my Custom CP Home Panels extension, be sure to download the latest version (1.0.1) for compatibility with Google Analytics Panel.

UPDATE

Version 1.1 adds the following:

  • MSM support
  • member group permissions (decide which groups can display the Analytics Panel)
  • better password security (passwords are now base64-encoded, and never displayed to the user on the settings screen)
  • “yesterday” and “last month” stats are cached daily for quicker home screen load times

Looking for an EE2-compatible version? Lookie here.

       
angstmann's avatar
angstmann
225 posts
16 years ago
angstmann's avatar angstmann

Excellent. Sounds great, and perfect timing for a client site that I’m hoping to launch this week. So presuming all works as expected, and its stable, I can see me using this and it becoming an absolutely great extension!

       
adro's avatar
adro
110 posts
16 years ago
adro's avatar adro

Absolutely brilliant! Can’t wait to try this out

       
angstmann's avatar
angstmann
225 posts
16 years ago
angstmann's avatar angstmann

Just tried it on my own site and it works perfectly 😊

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
16 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Fantastic extension Derek! I loaded it up and don’t see all of my profiles though. My particular google account is setup as an “admin” to numerous accounts and 4 of my profiles (all under a single account) are not showing up. I don’t know how the Analytics API works so I don’t know what settings to look for in GA. Any thoughts?

Also, in the docs you mention that the API is kinda slow. Have you considered building in a cache to the extension and allow a refresh setting in the extension settings?

Great Job! 😊

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

Just pushed an update to GitHub to fix this Erik (I was only fetching 20 profiles - now it will fetch 100).

Re: caching - I did consider that, but it definitely makes it less useful. I really wanted to have a “Today” display, and a cache kinda defeats that. Since the home screen isn’t repeatedly loaded as a general rule, I wasn’t going to get my panties in a knot over the slight lag. 😊

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
16 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
Just pushed an update to GitHub to fix this Erik (I was only fetching 20 profiles - now it will fetch 100).

Sweet. Thanks for the quick update. Fantastic extension. 😊

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
16 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Is there any way the password can be stored and used in an encrypted format? Unfortunately storing the password in the database is a deal breaker for me for security reasons…

       
sm9's avatar
sm9
352 posts
16 years ago
sm9's avatar sm9

Hi there,

Thanks for this extension - been hoping for something like this for a while now!

I’ve installed it, but I can’t seem to get it working. It keeps saying “No account profiles available (check credentials?)” even though I’ve entered the correct username and password, the same details as I use to login to google.com/analytics.

I’ve even tried different variations for the username - username, [email protected], [email protected], etc, but to no avail. Have tried two sets of usernames actually and neither worked when I went back into the settings after saving them (both Administrator roles for the Google Analytics profiles). I’ve also tried disabling and re-enabling the extension, deleting, re-downloading it from GitHub (both zip and tar versions for good measure), and re-installing, but no joy.

I’m using 1.6.8 build 20091002 and the server is running php 5.2.10. Have also got 1.0.1 version of the Custom CP Home Panels installed.

Any ideas?

Thanks.

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue
Is there any way the password can be stored and used in an encrypted format? Unfortunately storing the password in the database is a deal breaker for me for security reasons…

Would base64 encoding do the trick for you? It would be encoded in the database, so peering eyes couldn’t see it, but it can of course be decrypted using base64_decode if someone cared to.

It keeps saying “No account profiles available (check credentials?)” even though I’ve entered the correct username and password, the same details as I use to login to google.com/analytics.

All I can think of is asking if you’re 100%, positively sure that your credentials are correct. 😊 When I was writing this extension, I almost gave up, thinking that something in EE was blocking the authentication routine, until I realized I had transposed two characters in my username.

Google does expect an email address as the account login.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
16 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
Is there any way the password can be stored and used in an encrypted format? Unfortunately storing the password in the database is a deal breaker for me for security reasons…
Would base64 encoding do the trick for you? It would be encoded in the database, so peering eyes couldn’t see it, but it can of course be decrypted using base64_decode if someone cared to.

Well my primary concern is I may have an EE site where multiple people manage extension settings but only one person needs to know the GA info. When loading the settings to this extension the password field would decrypt the password so that it’s correct on submission again. Honestly I know know what the best solution would be here…

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
16 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
Is there any way the password can be stored and used in an encrypted format? Unfortunately storing the password in the database is a deal breaker for me for security reasons…
Would base64 encoding do the trick for you? It would be encoded in the database, so peering eyes couldn’t see it, but it can of course be decrypted using base64_decode if someone cared to.
Well my primary concern is I may have an EE site where multiple people manage extension settings but only one person needs to know the GA info. When loading the settings to this extension the password field would decrypt the password so that it’s correct on submission again which means the password is visible in the source (value=”the_password”). Honestly I know know what the best solution would be here…

Edit: Great…looks like I click “quote” instead of “edit” on that one. Sorry about that! I wish I could delete accidents like this…

       
Derek Hogue's avatar
Derek Hogue
317 posts
16 years ago
Derek Hogue's avatar Derek Hogue

I see what you’re saying. I don’t think there’s really a way around this, besides a far more complicated settings process. Something like: enter credentials, and if they verify, store them and no longer display the username/password box. Then add a “forget credentials” option, which would delete them and offer up the form again.

I’d suggest creating a new Google account for this particular site, and adding that account as a “user” to that site’s profile in GA, then logging in to the extension with that account. That way, access to the password is of no worry.

       
sm9's avatar
sm9
352 posts
16 years ago
sm9's avatar sm9
It keeps saying “No account profiles available (check credentials?)” even though I’ve entered the correct username and password, the same details as I use to login to google.com/analytics.
All I can think of is asking if you’re 100%, positively sure that your credentials are correct. 😊 When I was writing this extension, I almost gave up, thinking that something in EE was blocking the authentication routine, until I realized I had transposed two characters in my username. Google does expect an email address as the account login.

Yeah, I’ve checked them and typed them in very carefully (3 different Google accounts now) but with no joy. My very first attempt did use the wrong password though, but the next 10 attempts were definitely correct. 😊

Not to worry, I’ll try it on another site and see if I have any joy there.

Thanks.

       
gaweb's avatar
gaweb
77 posts
16 years ago
gaweb's avatar gaweb

Wow, works great!

Thanks!

Would love to see MSM support and maybe some more users settings.

I love how it lists todays stats.

Thanks

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.