RedPig Posted July 14, 2015 Share Posted July 14, 2015 Hi guys, I have looked through the forum and can only really find 1 post with the same problem but its has had no replies. SO im starting a new threat to hopefully get some attention to it. I have loaded and put in my Google Analytics code (the UA-65xxxxxx code) into the module as normal. All seems to work fine there. However when I go to the Google Analytics API v1.1.0 Module and try and load in my credentials I get the following error. 400. That’s an error. Error: invalid_request Invalid parameter value for redirect_uri: Missing scheme: modules/gapi/oauth2callback.php Learn more Request Detailsscope=https://www.googleapis.com/auth/analytics.readonly response_type=code access_type=offline redirect_uri=modules/gapi/oauth2callback.php approval_prompt=force state=1-e9f5f745e933668baadd02a2fefae061 client_id=300039335954-tr0pli7nb88ir979a2ne3brbnp6sr3af.apps.googleusercontent.com That’s all we know. I have tried just about everthing I could find on the little posts I could find. Any help or suggestions would be much appreciated. 2 Link to comment Share on other sites More sharing options...
yoimthebest Posted July 14, 2015 Share Posted July 14, 2015 same problem here, wrote here to get post update by email. Link to comment Share on other sites More sharing options...
mynewborn Posted July 14, 2015 Share Posted July 14, 2015 (edited) Is it this problem you get (see attachment). If it's, I think it is after you pressed the button 'no tests received' into PS backoffice>modules>Google API Well after you get the error, just go to the previous page on your internet browser and normally you will get a green button with example: "yesterday your shop received 100 visitors for a total of...". If not, you need to Enable your API into Google developers. Edited July 14, 2015 by mynewborn (see edit history) Link to comment Share on other sites More sharing options...
RedPig Posted July 14, 2015 Author Share Posted July 14, 2015 (edited) Hi mynewborn, Thanks for the reply. That is the error Im getting. If I go back to the previous page all I get is the Google Analytics API module asking me to ender in the details again. My API is active in google developers and the credentials are setup as well. Maybe Ive done something wrong there. Edited July 14, 2015 by RedPig (see edit history) Link to comment Share on other sites More sharing options...
mynewborn Posted July 14, 2015 Share Posted July 14, 2015 I did my settings into this: https://console.developers.google.com If it works you should get something like in attachment (i completed today, so nothing to show in the graphics). Link to comment Share on other sites More sharing options...
RedPig Posted July 15, 2015 Author Share Posted July 15, 2015 Hi mynewborn, Thats exactly where I did mine. How ever when I go to the screen (like in your attachment) No requests or anything are there. I have loaded everything as per the instructions with and with out www. Still when I add the credential details to the Google API module I get that error. Link to comment Share on other sites More sharing options...
roed Posted July 15, 2015 Share Posted July 15, 2015 Same here. It started after upgrading PS to 1.6.1.0 so I think that is the reason. Link to comment Share on other sites More sharing options...
mynewborn Posted July 15, 2015 Share Posted July 15, 2015 Normally it can't be the update (i think). I hope you can fix it. Maybe do step by step again... Link to comment Share on other sites More sharing options...
RedPig Posted July 16, 2015 Author Share Posted July 16, 2015 So gone through it all step by step and reloaded and refreshed everything. Does somebody know where I could download that module again. (the ones in the store are all paide modules) Maybe deleting the module and re-installing it will help. The only thing I can think of now is that the module has an issue. Link to comment Share on other sites More sharing options...
mynewborn Posted July 17, 2015 Share Posted July 17, 2015 here you can download the module for free. The module has no issue, because else there would be more people with this problem and mine is working fine. Link to comment Share on other sites More sharing options...
Popular Post navodyc4 Posted July 17, 2015 Popular Post Share Posted July 17, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); 18 Link to comment Share on other sites More sharing options...
RedPig Posted July 18, 2015 Author Share Posted July 18, 2015 (edited) Hi navodyc4 Thanks so much for the reply. I have tried your suggestion. It finally seems to be doing somthing at least. It now asked me for permission which I granted. However when its done I get the following messages. Google API Authorization granted but access token cannot be retrieved and Cannot retrieve test results. Thanks navodyc4 It finally feels like IM getting somewhere. Do you perhaps know why I would be getting those 2 errors above? UPDATE: I have tried to submit the details a few times now and get a mixture of the above 2 errors and Google is unreachable (check your firewall). Final UPDATE: After re-submitting about 10 times it finally took and everything is working. THANK YOU SO MUCH navodyc4 and to all who tried to help. This has been bugging me for WEEKS. Edited July 18, 2015 by RedPig (see edit history) 1 Link to comment Share on other sites More sharing options...
Statuesque Posted July 28, 2015 Share Posted July 28, 2015 navodyc4 - you genius For about 5 weeks I have been trying to get this working after it stopped randomly for some reason. Your fix has worked immediately. Thank you so much. This has ben bugging the hell out of me. Contacted web hosts, have uninstalled google modules so many times, have created new projects, reset secret etc etc. I am now very happy Link to comment Share on other sites More sharing options...
clneal2003 Posted July 29, 2015 Share Posted July 29, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); How do manipulate module code? I've tried everything state above multiple multiple times. It seems somewhere the prestashop directions are outdated or missing something. When you go through google and enable api's in the https://console.developers.google.com/project/agile-polymer-102103/apiui/apis/library?authuser=1 the UI is different... then when you "create client ID" a you can't enter your site and site/modules/gapi/oauth2callback.php until you "configure consent". I'm thoroughly confused... Also, does the analytics information get pulled to the Prestashop Dashboard after all this? Link to comment Share on other sites More sharing options...
clneal2003 Posted July 29, 2015 Share Posted July 29, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); myshop/gapi/gapi.php is blank. Link to comment Share on other sites More sharing options...
clneal2003 Posted July 29, 2015 Share Posted July 29, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); This actually worked! I can't believe it took 3 days to find your work around... and then another half an hour to get implemented. THANKS. I'll just look for your post after the next updates. 1 Link to comment Share on other sites More sharing options...
dunikowski Posted July 29, 2015 Share Posted July 29, 2015 Removing 'true' from lines 135 and 164 in modules/gapi/gapi.php worked for me. Thank you so much. For editing php files, use Notepad++ https://notepad-plus-plus.org/download/v6.8.html Link to comment Share on other sites More sharing options...
Yegoh Posted July 29, 2015 Share Posted July 29, 2015 Thx for the tip. Link to comment Share on other sites More sharing options...
ThiloH Posted July 31, 2015 Share Posted July 31, 2015 That solution worked for me, too. Thanks! Link to comment Share on other sites More sharing options...
abehsera Posted August 6, 2015 Share Posted August 6, 2015 It also worked for me! Link to comment Share on other sites More sharing options...
Vitazzz Posted August 12, 2015 Share Posted August 12, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Applied this change, still got same error.. Link to comment Share on other sites More sharing options...
JLeonrp Posted August 12, 2015 Share Posted August 12, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Thanks a lot for this! It worked for me also. Can't believe it took me 2 days to find this post to help me solve the problem Link to comment Share on other sites More sharing options...
Ballerina'sWorld Posted August 13, 2015 Share Posted August 13, 2015 What can I do? I have the same problem but I use Cloud version so to change the rows I think it is impossible... Please help. Link to comment Share on other sites More sharing options...
gabdara Posted August 13, 2015 Share Posted August 13, 2015 What can I do? I have the same problem but I use Cloud version so to change the rows I think it is impossible... Please help. If you setup a FTP account from My store > Manage store you will be able to modify your modules files. Link to comment Share on other sites More sharing options...
Janvier-nuio Posted August 13, 2015 Share Posted August 13, 2015 (edited) Didn't really work for me, now I get : Error: redirect_uri_mismatch Application: TPV Analytics API The redirect URI in the request: http:/ /www.mystore.fr/modules/gapi/oauth2callback.php did not match a registered redirect URI Could it be because I use https ? Edited August 13, 2015 by Janvier-nuio (see edit history) Link to comment Share on other sites More sharing options...
Ballerina'sWorld Posted August 13, 2015 Share Posted August 13, 2015 If you setup a FTP account from My store > Manage store you will be able to modify your modules files. Cool! I have been looking for it about for 3 days how I can modify files... Thank you. Link to comment Share on other sites More sharing options...
dformica Posted August 15, 2015 Share Posted August 15, 2015 (edited) Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); This worked for me, Thank you!! Connection was successful but I have the following message "Cannot retrieve test results". Edited August 15, 2015 by dformica (see edit history) Link to comment Share on other sites More sharing options...
rickczsu Posted August 18, 2015 Share Posted August 18, 2015 navodyc4: Many thanks Link to comment Share on other sites More sharing options...
Chima42 Posted August 18, 2015 Share Posted August 18, 2015 Worked for me too Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); THIS WORKED FOR ME TOO. AFTER 3 HOURS OF SEARCHING. Thnak you so much ! Link to comment Share on other sites More sharing options...
Cruck Posted August 21, 2015 Share Posted August 21, 2015 Thank you navodyc4 This solved my problem too. Link to comment Share on other sites More sharing options...
dformica Posted August 21, 2015 Share Posted August 21, 2015 Anyone getting "Cannot retrieve test results" after applying navodyc4 fix? Link to comment Share on other sites More sharing options...
moraira Posted August 21, 2015 Share Posted August 21, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Thanks Mate... like a boss Link to comment Share on other sites More sharing options...
moraira Posted August 21, 2015 Share Posted August 21, 2015 Anyone getting "Cannot retrieve test results" after applying navodyc4 fix? make sure you are logged your browser with your right google account when you configure the module. Link to comment Share on other sites More sharing options...
protechtrader Posted August 23, 2015 Share Posted August 23, 2015 The fix worked for me as well on 1.6.1.1 but it gives this error on the backend on module and performance tabs at the top: 2 errors gapi (parse error in /modules/gapi/gapi.php) gapi (class missing in /modules/gapi/gapi.php) When I replace the gapi.php with original this error is gone but the module goes back to not working. Remove the two "true" words from the code as per the fix and the module works but I get this error. How can I remove this error? Link to comment Share on other sites More sharing options...
protechtrader Posted August 24, 2015 Share Posted August 24, 2015 The fix worked for me as well on 1.6.1.1 but it gives this error on the backend on module and performance tabs at the top: 2 errors gapi (parse error in /modules/gapi/gapi.php) gapi (class missing in /modules/gapi/gapi.php) When I replace the gapi.php with original this error is gone but the module goes back to not working. Remove the two "true" words from the code as per the fix and the module works but I get this error. How can I remove this error? Anyone have any thoughts? Module seems to work great with this basic fix, just removing the 8 characters outlined in this post fixed it for me ("true" & " true"), but it left me with this error on the backoffice, it is on the dashboard and everywhere in backoffice. Link to comment Share on other sites More sharing options...
Alvaroso Posted August 25, 2015 Share Posted August 25, 2015 Anyone getting "Cannot retrieve test results" after applying navodyc4 fix? I have the same problem. Link to comment Share on other sites More sharing options...
Ballerina'sWorld Posted August 25, 2015 Share Posted August 25, 2015 I had the same problems. Regarding those 2 errors in backoffice, go to your modules and check Google Analytics API because after that fixing it came again like "Install". I clicked on it, and it was written that it is already installed but errors disappeared. Then regarding "Cannot retrieve test results" and this error: Error: redirect_uri_mismatch Application: TPV Analytics API The redirect URI in the request: http:/..... /modules/gapi/oauth2callback.php did not match a registered redirect URI... I have found that google sometimes cannot read "www" and really this worked for me: 1) In Developers Console - Consent Screen in Homepage URL - remove "www" so it will stay only http://domain.com and 2) in Developers Console - Credentials - Cliend ID - Authorized Javascript Origins http://www.domain.com http://domain.com 3) and in Authorized redirect URI http://www.domain.com/modules/gapi/oauth2callback.php Link to comment Share on other sites More sharing options...
protechtrader Posted August 26, 2015 Share Posted August 26, 2015 I had the same problems. Regarding those 2 errors in backoffice, go to your modules and check Google Analytics API because after that fixing it came again like "Install". I clicked on it, and it was written that it is already installed but errors disappeared. This didnt work for me at all I tried multiple times. I overwrote the module with the version on github @ https://github.com/PrestaShop/gapi and it fixed this error and original problem. Modification was not needed. Link to comment Share on other sites More sharing options...
moderk Posted September 2, 2015 Share Posted September 2, 2015 I don't have such lines $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); In my modules/gapi/gapi.php and have same problem. Any solution ? My module version : 1.2.0 PRESTA SHOP: 1.6.0.14 Link to comment Share on other sites More sharing options...
pawelwaw Posted September 2, 2015 Share Posted September 2, 2015 Hi, I have the same problem as moderk, my version of presta is 1.6.0.5, because I made update this module to 1.2.0 and then I remove true value from getContextShopID functions. When I make autorization then I saw message, that I should confirm - so I confirm this. However in google Analitics, I see only how many users is on my site, I don't see conversions in E-commerce even I saw It earlier. Can anybody know where the problem is? Link to comment Share on other sites More sharing options...
dannunz Posted September 11, 2015 Share Posted September 11, 2015 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Grazie!!! Thank u so much navodyc4 !!!! 1 Link to comment Share on other sites More sharing options...
Jeroen040 Posted September 22, 2015 Share Posted September 22, 2015 Great solution! Thank you for that! But I also get 2 errors in backoffice: gapi (parse fout in /modules/gapi/gapi.php) gapi (klasse ontbreekt in /modules/gapi/gapi.php) Any help on how to fix this? Link to comment Share on other sites More sharing options...
Poolpoelone Posted September 23, 2015 Share Posted September 23, 2015 This solution works 4 me ª!! tnx navodyc4 Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Link to comment Share on other sites More sharing options...
sounds Posted September 25, 2015 Share Posted September 25, 2015 Thanks for the solution, removing true from line 135 and 164 worked for me in ps 1.6.1.1 The only problem I see is when I save the module settings, Cannot retrieve test results Link to comment Share on other sites More sharing options...
Admin27 Posted September 27, 2015 Share Posted September 27, 2015 Now Solved the problem Link to comment Share on other sites More sharing options...
bynovita Posted September 28, 2015 Share Posted September 28, 2015 Cannot retrieve test results help Link to comment Share on other sites More sharing options...
daniloas Posted October 1, 2015 Share Posted October 1, 2015 navodyc4 You are F#$@! genius!!!! THANK YOU mate!!!! Link to comment Share on other sites More sharing options...
carmy Posted October 3, 2015 Share Posted October 3, 2015 (edited) It also worked for me! Hi, but problem is in API Google Analytics module. Try change in modules/gapi/gapi.php this two rows: $shop = new Shop(Shop::getContextShopID(true)); and $shop = new Shop(Shop::getContextShopID(true)); to (only remove true) $shop = new Shop(Shop::getContextShopID()); Thank you navodyc4! It worked for me! Prestashop version 1.6.0.14 Edited October 3, 2015 by carmy (see edit history) Link to comment Share on other sites More sharing options...
bynovita Posted October 5, 2015 Share Posted October 5, 2015 (edited) help 1.6.1.1 Edited October 5, 2015 by bynovita (see edit history) Link to comment Share on other sites More sharing options...
durthu Posted October 5, 2015 Share Posted October 5, 2015 The changes in gapi.php files worked like a charm, however, I'm also seeng this error: Cannot retrieve test results help Link to comment Share on other sites More sharing options...
Jeroen040 Posted October 5, 2015 Share Posted October 5, 2015 (edited) Has anybody found a solution to get rid of this annoying error: 2 fouten gapi (parse fout in /modules/gapi/gapi.php) gapi (klasse ontbreekt in /modules/gapi/gapi.php) Edit: Found the solution. After you've edited the file and GAPI is working, put "true" back into the lines and upload the file again. Errors are gone and it is still working. Edited October 6, 2015 by Eurobesparen (see edit history) Link to comment Share on other sites More sharing options...
tsunamisurfing Posted October 6, 2015 Share Posted October 6, 2015 Fantastic! It's work fine on my shop! Note: that I've removed "true" on the line 238 in addition to 135 and 164. Link to comment Share on other sites More sharing options...
uelskid Posted October 10, 2015 Share Posted October 10, 2015 Yo! My 2 cents: thanks navodyc4 for a nice solution, BUT i was recieving "cant recieve test results" error still. 1) So i've dowloaded a new gapi from here https://github.com/PrestaShop/gapi 2) Just deleted the old gapi and put this one instead 3) Removed "true" from the line 238 (as tsunamisurfing) said After that it worked for me straight away. Link to comment Share on other sites More sharing options...
sounds Posted October 11, 2015 Share Posted October 11, 2015 I almost forgot how I got that error Cannot retrieve test results Anyway, I went back to modules and searched gapi, I copied the client id, client secret and profile info, Then clicked save & configure & save & authenticate, no errors. So I'm guessing the error is gone. Link to comment Share on other sites More sharing options...
dungeoncrawler Posted October 12, 2015 Share Posted October 12, 2015 Brilliant! Thank you. Dear Prestashop, please fix this in your next update! Link to comment Share on other sites More sharing options...
qaphsiel Posted October 14, 2015 Share Posted October 14, 2015 Google API Authorization granted ×Cannot retrieve test results Facing the same issue too Link to comment Share on other sites More sharing options...
JackusD Posted December 16, 2015 Share Posted December 16, 2015 Having this issue too. Was working for a few months and suddenly today it started saying "Google is unreachable (check your firewall)". I've tried all the solutions offered here without any luck... Anybody have any other suggestions? 2 Link to comment Share on other sites More sharing options...
Chingy59 Posted March 14, 2016 Share Posted March 14, 2016 Hello, I have the same issue as JackusD. It was working perfectly for nearly a year and suddenly started showing "Google is unreachable (check your firewall)". I tried all the solutions I could find in this forum without success. Does anyone have a real way to fix this ? Thanks in advance, 1 Link to comment Share on other sites More sharing options...
Vlam Posted May 24, 2016 Share Posted May 24, 2016 (edited) Hello, Same issue as @JackusD and @Chingy59. How do you fix it ? Edited May 24, 2016 by Vlam (see edit history) Link to comment Share on other sites More sharing options...
Vlam Posted May 26, 2016 Share Posted May 26, 2016 UP Link to comment Share on other sites More sharing options...
JLeonrp Posted May 26, 2016 Share Posted May 26, 2016 Hey @Vlam, I've been dealing with an erratic working on the default Analytics module for several months, so what I decided to do was to simply put the analytics code directly into the header.tpl under the /themes/mytheme/ location and inside literal tags. Everything runs smoothly now. Link to comment Share on other sites More sharing options...
JackusD Posted May 26, 2016 Share Posted May 26, 2016 Thanks, @JLeonrp, I'll give this a go! Were you getting the "Google is unreachable (check your firewall)" error too? Link to comment Share on other sites More sharing options...
JLeonrp Posted May 26, 2016 Share Posted May 26, 2016 Thanks, @JLeonrp, I'll give this a go! Were you getting the "Google is unreachable (check your firewall)" error too? Yes @JackusD, among others. Tested a lot of possible solutions but nothing worked, so I decided to go back to basis and write the code into the header and now the analytics work like a charm. Of course, don't expect to see Google analytics graphs or results on your backoffice. I disabled the module to avoid confusion. Link to comment Share on other sites More sharing options...
JackusD Posted May 26, 2016 Share Posted May 26, 2016 Ahh, ok, so you're still having issues with the Google Analytics API module then? Link to comment Share on other sites More sharing options...
Vlam Posted June 15, 2016 Share Posted June 15, 2016 Still no solution (?) Link to comment Share on other sites More sharing options...
Vlam Posted June 20, 2016 Share Posted June 20, 2016 I just update to 1.6.1.6 version and google analytics API works fine now. Link to comment Share on other sites More sharing options...
Marek_O Posted December 1, 2016 Share Posted December 1, 2016 (edited) I use PS 1.6.1.6 and gapi v1.2.1 still get this error after havin set up everything in Google and gapi module: 400. That’s an error. Error: invalid_request Missing required parameter: redirect_uri Learn more Request Detailsamp;access_type=offline amp;scope=https://www.googleapis.com/auth/analytics.readonly amp;approval_prompt=force response_type=code amp;state=1-3100bcf4d5db6808454c17a46c amp;client_id=55059508707-j__removed_by_me__nrnajefogaik.apps.googleusercontent.com amp;redirect_uri=http://www.fuzzmatazz.com/modules/gapi/oauth2callback.php But I don'T get it, the redirect_url is part of the reqeust as I can see in the last line: "amp;client_id=55059508707-dg3clu76j__removed_by_me__nrnajefogaik.apps.googleusercontent.com" ??? Edited December 1, 2016 by Marek_O (see edit history) Link to comment Share on other sites More sharing options...
Marek_O Posted December 1, 2016 Share Posted December 1, 2016 I got a bit further, i found out the during the credential test, the gapi modules decode every "&" in the url to "amp;" but the url ends up corrupted ... like "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=..." but it should be: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id= So after deleting all "amp;" and just hitting enter, i got the google page to grant access, but now i get the Error in the module saying: "Google API Authorization granted but access token cannot be retrieved" and "Cannot retrieve test results" Link to comment Share on other sites More sharing options...
Recommended Posts