Jump to content

ProcessGoogleAnalytics


Wanze

Recommended Posts

  • 2 weeks later...

Hi Processwires!

Just updated the module with some small improvements:

  • Loading Animation for each section for better usability
  • Date Range: If your range is smaller than 3 days, the module queries the visitors per date AND time. For example: If your date range is "24 hours" back, then you will now get the count of visits per hour. Before, you only got a straight line between two dates. ;-)
  • Optional feature: For the visits and pageviews, the module allows you to display the difference compared to the previous date range. This should give you a quick idea, if your website has more or less visitors compared for example to the month before.
    See the attached Screenshot
    By default this setting is disabled, but you can enable it in the module settings

I also updated jqplot and the Google API Client to the newest versions. Let me now if you run into problems with some setups!

Cheers

post-582-0-27331800-1353119965_thumb.png

  • Like 4
Link to comment
Share on other sites

Hi Wanze, I have no idea why but going to my analytics page now in admin crashes the whole page.

I tried updating and now it's stuck with the loading image too.

It seems to only happen to me with Chrome though (I'm on a Mac) though that may be as it's where I've been using it before. Can't think why it's doing this, any ideas?

Thanks

Link to comment
Share on other sites

Hmm do you get any error messages in your Javascript Console in Chrome?

I'm also on Mac and it seems to work fine here with chrome.

Try:

  • Clear the browsers cache
  • Clear the cache from the statistics generated with MarkupCache
    => Go to the module options and for example change the default date range and save, this should also clear the MarkupCache behind.

Does it work with other browsers?

Btw I just noticed that Chrome does not support APNG, so I will change the loading animation to a gif..

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Comitted a new version to GitHub.

There are no new "must-have" features, it was more refactoring the code with some small improvements:

  • Use my own (lightweight) class to query the stats instead of the bloated google api php client
  • Removed config options not really necessary for simpler setup: Developer-Key, Redirect-Uri
  • Use "MarkupAdminDataTable" to generate the tables - they integrate better in other admin themes
  • Custom date range bypasses caching of the regular date range - no need to "clear the custom date range"
  • Added option to clear the statistics cache under the options tab
  • Added some more comparisons to the previous date range

So it's up to you if you want to update :)

Important

If you update, you need to revoke authentication and choose the Google Analytics account again.
Check "Revoke Authentication" in the module's config and save, visit the Google Analytics page and click "authenticate".

Then choose the account again.

  • Like 4
Link to comment
Share on other sites

  • 2 months later...

Hi Wanze,

Have you ever seen it happen where another site's content ends up in the analytics content?

It's very strange as I have a completely unrelated site with different UA codes. Not sure if you've ever come across that?

Cheers.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 months later...

Great module!

I only have one problem - cannot get it running on my VPS (runs great locally on MAMP).

When trying to authenticate I get: Could not fetch the accessToken (Apache 2.2.5/PHP 5.4.19)

I've tested it on two sites and also on a fresh install of the latest build - same result.

Any ideas?

Link to comment
Share on other sites

Hi Peter,

Thanks!

My guess is that you maybe forgot to add the redirect URL in the Google APIs console which points to your VPS server?

Here is where this error comes from: https://github.com/wanze/ProcessGoogleAnalytics/blob/master/ProcessGoogleAnalytics.module#L955

Google does not return a HTTP 200 status. If you can't solve the problem by setting the redirect URI, you can try to add this code:

if ($auth['http_code'] != 200) {
  print_r($auth); die(); // Add this line and check which error code is returned
  $this->error('Could not fetch the accessToken');
  return;
}

Good luck :)

  • Like 1
Link to comment
Share on other sites

Thanks John!

@Peter

I can't access your Pw admin :)

Can you post here what was printed out? Should be an array with a status code other than 200.

If nothing was printed, then this seems to be an issue with the curl setup of your server.

I coded the class which is interacting with google. Recently there turned up a similar problem on one installation.

Not sure if this solves the problem here, but you could try to add this line in the GoogleAnalyticsAPI.class.php file,

after this line here

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
Link to comment
Share on other sites

  • 4 months later...

@JoZ3

Does this happen only in Firefox? Another browser does work?

The statistics are loaded with ajax requests, so if nothing shows up, this normally means that there is an error happening on the server side.

Can you open you Javascript console, for example the native one in Firefox or the one in Firebug and check if you get any errors reported?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...