Frank Vèssia Posted August 12, 2012 Share Posted August 12, 2012 That's because the results were getting cached. But you still don't see any Statistics, right? I think there has to be an error in your setup somewhere. Tested also the date "d-m-Y", works fine here on my local installation. Will check if Google reports back some error codes in case something went wrong with the query params... Edit: If you want to do some more testing, you should disable caching the output: 1) Delete the folders starting with "ga_" in site/assets/cache/MarkupCache 2) In the Module Options, set Cache Time to "0" Maybe i got the problem. I'm displaying the statistic of a new website...so no rows have been created, that's why i can see the notices and warning...but meanwhile i made some visitors and now i can see statistics except the mobile block that is still displaying those notices... You have to manage this case. Link to comment Share on other sites More sharing options...
Wanze Posted August 12, 2012 Author Share Posted August 12, 2012 If I had to wish for anything it would only be that I could get more detail on the referrers. Like when I see a new referrer show up, I'd love to click to see the URL where the referring link actually exists. I remember seeing this somewhere, should be possible to implement with the GA api. Will be there in the next version I'm not sure what the best behavior would be here, as I'm guessing everyone has their own workflow and timeline they want to look at in GA. But I do know that the first thing I do when I get into GA is to set a date range. It's rare that I want to look at the last month or year. Usually I want the last 24 hours, last 2 days, last week, etc. I've often wished that GA had a select box where I could choose "last 24 hours" for instance, rather than having to select starting and ending dates. I think another module option to define the default date range makes sense. Currently, this is always a month back from "today". I will add a dropdown one can choose the the date range (24 hours, 2 days, 3 days... 1 week, 2 weeks etc.) Maybe i got the problem. I'm displaying the statistic of a new website...so no rows have been created, that's why i can see the notices and warning...but meanwhile i made some visitors and now i can see statistics except the mobile block that is still displaying those notices... You have to manage this case. Thank you for testing, glad it turned out to be this simple! ;-) Will add the check in the next version. One quick fix for you is to visit the site with your mobile phone 1 Link to comment Share on other sites More sharing options...
Wanze Posted August 14, 2012 Author Share Posted August 14, 2012 Just commited version 1.1.1 Fixed PHP notices when debug mode is enabled (thanks Sevarf2!) If no results are returned from GA, display "no results found" Added module config option for a default date range: last 24 hours, last 2 days, last 3 days etc. If you want to look back more than 2 months by default, tell me... i'll add more values Traffic Sources: Added Referral Sources by URL. Provides also a link to visit the referral page, but as Ryan mentioned earlier, sometimes uri-variables are stripped resulting in invalid links! When you set a custom date range in the options section, you are "overwriting" the default date range. This can still be handy, for example if you want to look quickly at statistics from the past. Reset the custom date range to display stats again from the default one. 3 Link to comment Share on other sites More sharing options...
Frank Vèssia Posted August 14, 2012 Share Posted August 14, 2012 Great. Updated. 1 Link to comment Share on other sites More sharing options...
ryan Posted August 14, 2012 Share Posted August 14, 2012 Awesome update, thanks Wanze! Link to comment Share on other sites More sharing options...
Hani Posted September 8, 2012 Share Posted September 8, 2012 I'm getting a strange error when I go to the GA page (after authenticating) that shows up for each section were data is supposed to show up. The end of the errors say: Values must match the following regular expression: 'ga:[0-9]+'"} It is referencing the Google Analytics Account ID that I provided, which is in the format of UA-XXXXXXXX-X. That's the right GA Account ID to provide, correct? The installation instructions say to "Choose a Google Analytics Account from the Dropdown". However, I didn't see any place to do that. Is that related to the problem I'm having? Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2012 Share Posted September 9, 2012 @hani you have to enter it in this format ga:xxxxxxx as mentioned before by wanze, though still not sure what numbers. When I try ga:5735834-7 it doesn't work (regex not matching), when I enter ga:5735834, it seems to recognize it but still an error that access is not configured is shown. I also never come to select any account as mentioned in the description. @wanze, I'm trying since hours to get this module working and no luck so far. I got the same problem with entering the account id as mentioned above. After reading your posts again I still can't see what would be wrong. I entered all key and secrets and the account id, but it always returns some 400,403, or 500 or whatever. The get is shown like this: "Error calling GET https:\/\/www.googleapis.com\/analytics\/v3\/data\/ga?ids=ga%3A5735834&start-date=2012-08-09&end-date=2012-09-09&metrics=ga..." (403) Access Not Configured" So I wanted to uninstall the module, and I've seen that it will also uninstall the MarkupCache module in PW, which is a bad thing. It may be required by the module but a simple $modules->get will load it if installing you module, no need to make it required and uninstall it when uninstalling your module. Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2012 Share Posted September 9, 2012 Finally I seem to have it working after 1000 try and error. I create a new project on google API page, the one I already had was from another test I did a while ago. After entering the new key's I got still an error saying I don't have the permission... I'm not sure what I have done that it works now, but after authenticate, I can select an account after redirect. OMG! But after selecting an account I again get the same error "(403) Access Not Configured"}". Can it be really that hard? Link to comment Share on other sites More sharing options...
Wanze Posted September 9, 2012 Author Share Posted September 9, 2012 Guys, Sorry for the problems, let's find out why it isn't working. The correct ID you must provide is really hard to find out and the docs from Google suck! If you can't see the dropdown to select an GA-Account, then we need to debug together because I just tested and it works on my installation. Please try this: Enter the ID manually and check if the module works. You can find the ID in the Browsers URL when you are watching the statistics inside the normal Google Analytics page. The ID is build with the numbers after the "p": Add these numbers in the module settings (Google Analytics Account Id) and add "ga:" in front -> Format: ga:xxxxxxx Does it work? Normally, the module should do this step for you by detecting all your accounts and then display the dropdown: Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2012 Share Posted September 9, 2012 After a long time trying the account id I enter was always right. Though suddenly I've come to the select dropdown, but after selecting one I see again the error as before. Metioned in my previous post. Link to comment Share on other sites More sharing options...
Wanze Posted September 9, 2012 Author Share Posted September 9, 2012 After a long time trying the account id I enter was always right. Though suddenly I've come to the select dropdown, but after selecting one I see again the error as before. Metioned in my previous post. Can you delete all the cache files startin with "ga_" in "site/assets/cache/MarkupCache/" Just to make sure that the 403 errors are not cached! If this doesn't work, I have to look in the docs from Google in which cases this error is returned... Think I need to do some more error checking in the whole module... Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2012 Share Posted September 9, 2012 Please try this: Enter the ID manually and check if the module works. You can find the ID in the Browsers URL when you are watching the statistics inside the normal Google Analytics page. The ID is build with the numbers after the "p": Add these numbers in the module settings (Google Analytics Account Id) and add "ga:" in front -> Format: ga:xxxxxxx - Well is it meant to NOT enter the account ID in the module settings? - When I don't enter a account ID the analytics page in PW throws error without continuing. When I enter any, I get to auth via google and after redirect back to PW there's not select at all (only once it was there) and the 403 is shown in each panel. - The ID after the "p" is always different to every sub account. - What ID really is supposed to go there? Does it work? - NO matter what ID I take it doesn't work. - I always get a "403 access not configured" Normally, the module should do this step for you by detecting all your accounts and then display the dropdown: - I don't have any - I cleared cache any time I tried something. And please take out the MarkupCache dependencies. Not sure you've read my first post from today completely. It shouldn't install or uninstall MarkupCache core module at all. If your module is using it no need to install it, as the first $modules->get("MarkupCache") ... will install it on demand. Link to comment Share on other sites More sharing options...
Hani Posted September 9, 2012 Share Posted September 9, 2012 @hani you have to enter it in this format ga:xxxxxxx as mentioned before by wanze Oops! Totally missed that. Thanks. But, like Soma, after I put that number in like Wanze instructed I'm getting the "403 access not configured" error. I've never seen the drop down. Wanze, thanks for all your efforts on this module! I'll play around to see if I can figure out the solution. Link to comment Share on other sites More sharing options...
Hani Posted September 9, 2012 Share Posted September 9, 2012 By the way - I figured out a straightforward way to get your Google Analytics Profile ID. Go to your Google Analytics Account and select the domain you're working with. Click on Admin near the top right Click on the Profile tab The number is located next to "Profile ID" Like Soma mentioned, this is different for each domain you have in Google Analytics. Link to comment Share on other sites More sharing options...
Wanze Posted September 9, 2012 Author Share Posted September 9, 2012 - Well is it meant to NOT enter the account ID in the module settings? And please take out the MarkupCache dependencies. Not sure you've read my first post from today completely. It shouldn't install or uninstall MarkupCache core module at all. If your module is using it no need to install it, as the first $modules->get("MarkupCache") ... will install it on demand. No it's not. After authenticating with Oauth, the Module should give you a Dropdown to choose your Analytics Account (Domain!). It grabs the ID and stores it. If you delete the ID in the modules setting, you should be able to choose an Account from the dropdown again. Thank you for your tip, i will remove the dependency for MarkupCache, didn't know that it will be installed by Pw! By the way - I figured out a straightforward way to get your Google Analytics Profile ID. Go to your Google Analytics Account and select the domain you're working with. Click on Admin near the top right Click on the Profile tab The number is located next to "Profile ID" Like Soma mentioned, this is different for each domain you have in Google Analytics. Thanks. But if the module would work correctly, it would set this Id for you after you have chosen the GA-Account from the dropdown. No need to find it out by yourself! Please note that you can only display statistics from one Domain. There's definitely something going wrong Tomorrow: I'll grab a fresh copy of Pw, create a new Google API's Project and finally install the module. Hope I can reproduce what's not working... Link to comment Share on other sites More sharing options...
Hani Posted September 9, 2012 Share Posted September 9, 2012 Oh! Okay - I didn't know that you're supposed to leave the Profile ID blank and allow the module to set it for you once you select a domain from the drop down. So, I revoked access, deleted the cached folders and re-authenticated. When I expected to see the drop down, I now see this error: Error calling GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties?key=AIzaSyCrlnK06s5YWsui7VWnH62GFYjBqjAGpZw: (403) Access Not Configured Link to comment Share on other sites More sharing options...
Hani Posted September 9, 2012 Share Posted September 9, 2012 I figured it out! I noticed the AJAX queries to grab the data are including the API Developer key in the URL. However, according to Google (https://developers.g...rence#q_summary) it says that the parameter is optional and that you should do that when authenticating with OAuth 1.0. Since the module uses OAuth 2.0 for authentication, that query parameter should be left out. I commented out this line in the module (line 930 under the _loadGoogleApi function): $this->ga_client->setDeveloperKey($this->developerKey); That seems to have done the trick! It's loading the data beautifully! (And it also allows me to select the domain in the drop down correctly too.) 2 Link to comment Share on other sites More sharing options...
Wanze Posted September 10, 2012 Author Share Posted September 10, 2012 I figured it out! Yeah that's great thank you for finding this one! Seems like Google does not accept this parameter anymore, worked fine some weeks ago... I will update the source on Github today. Link to comment Share on other sites More sharing options...
Soma Posted September 10, 2012 Share Posted September 10, 2012 Thanks Hani for finding the issue. It works here too when changing. Link to comment Share on other sites More sharing options...
Hani Posted September 10, 2012 Share Posted September 10, 2012 My pleasure! Thanks for this module, Wanze. I love it! Link to comment Share on other sites More sharing options...
Wanze Posted September 12, 2012 Author Share Posted September 12, 2012 Finally comitted the fix to Git! I hope to make some other improvements in the next few weeks. By the way, I found a stupid mistake. You were not supposed to see the "Google Analytics Account Id" in the module config, unless already chosen from the Dropdown. It's clear that people get confused when this setting exists right after the install... Check this code out: //Ga Account ID - only display when Account was chosen with dropdown before $field = ($data['accountId']) ? $modules->get("InputfieldText") : $modules->get("InputfieldHidden"); $field = $modules->get("InputfieldText"); Aaaaaaaaaaargh :- 1 Link to comment Share on other sites More sharing options...
Soma Posted September 16, 2012 Share Posted September 16, 2012 One thing I noticed is that it can take quite some time to load the statistics and I think there should be some ajax loader indicator animation while it's loading. 1 Link to comment Share on other sites More sharing options...
onjegolders Posted November 8, 2012 Share Posted November 8, 2012 Just wanted to say a huge thanks for the time you've put into this Wanze! One tiny thing, can you tell me which line of code you set the admin heading. Just wanted to change from Google Analytics to Analytics to save some space in the menu! I'm in awe of just how much code has gone into this, thanks again Link to comment Share on other sites More sharing options...
Wanze Posted November 8, 2012 Author Share Posted November 8, 2012 Thanks onjegolders, you're welcome! You can change the title field of the GA-Page which is in your Site-Tree under "Admin". Actually i hope to implement some planned improvements over the next week. Link to comment Share on other sites More sharing options...
onjegolders Posted November 8, 2012 Share Posted November 8, 2012 Thanks onjegolders, you're welcome! You can change the title field of the GA-Page which is in your Site-Tree under "Admin". Actually i hope to implement some planned improvements over the next week. Thanks Wanze, you know I didn't even realise I could access admin pages from the tree?! Cheers! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now