Jump to content

Google Analytics API


Recommended Posts

  • 2 months later...
For me module works correct. I found this:


 

Copy your Profile ID from google analytics account URL and set:

Redirect URIs:


http://yourdomain.yourdomain/modules/gapi/oauth2callback.php

in google developers console.

Edited by sweszler (see edit history)
  • Like 2
Link to comment
Share on other sites

@swezler: Thanks I guess this is not the problem - but I'm not sure about that. It took some tries to get the authorization working - so I think the data is correct as the module tells: Google API Authorization granted (before we got errormassages).

Which version of prestashop do you use? And do use SEF Links etc.?

@lukruk: there is a step by step guide in the module itself ;) Me had overseen this...

Greets,

Marcus

 

  • Like 1
Link to comment
Share on other sites

@lukruk: there is a step by step guide in the module itself ;) Me had overseen this...

 

Greets,

Marcus

 

If it your guide so Markus please help me

1. What key i should create ?

fca97116a0d1abf1.jpg

 

If Browser key, what should I write ?

ac099dc38d2c2249.jpg

 

2. What I should past in to presta analistyc API configurate ?

2b13d848d90e7134.jpg

 

3. And what should I write to create web aplication ?

87f1c07ec40be908.jpg

 

Client secret is important ?

  • Like 2
Link to comment
Share on other sites

There are step by step instructions in the module itself (which is nice)! Here's a quick write up just in case it's not showing up in your module. 

 

What's needed to work with this module: Google Analytics Account & a Google APIs Account. These instructions are for the v3.0 setup

 

Setting up your Google API:

 

1. Go to your Google API console: https://code.google.com/apis/console

2. Go APIs (under APIs & auth) and turn Analytics API on. Accept the terms & agreements. 

3. Go to credentials & click "Create New Client ID" 

4. Make sure Web Application is highlighted. Under Authorized JavaScript origins enter: https://www.yourwebsite.com

5. Under Authorized redirect URI enter: https://www.yourwebsite.com/modules/gapi/oauth2callback.php

6. Your API should be set now be set up correctly in Google API. Remember your Client ID & Client Secret since they are needed for setup. 

 

Setting up your consent screen: 

 

7. Go to Consent Screen (under API and auth) and setup as wished. I found the activation with Prestashop won't work if the consent screen isn't setup. You might get an "invalid client" error. 

 

Setting up your module in Prestashop: 

8. In your Prestashop module enter your Client ID & Client secret. These are found in Credentials tab in your Google API. 

9. Enter your Google Analytics View ID in the profile tab. You can find your View ID by going to your Google Analytics account click admin -> view -> view settings -> & View ID will be at the top. 

 

Hope this helps! Make sure to give it some time if you just created your Google Analytics account. 

Edited by CRAEXIS (see edit history)
  • Like 5
Link to comment
Share on other sites

Your profile shouldn't be your User Analytics ID (UA-###), it should be your Google Analytics View ID which will be a string of numbers. If you go to your Google Analytics Overview it's the last numbers after "p". You can also find your View ID by following these steps. 

 

1. Go to your Google Analytics overview. 

2. Click the Admin tab (next to Customization) 

3. Click "View Setting" which is located under "All Web Site Data" on the far right hand side.

4. Your view ID is the string of numbers located under basic settings. 

 

I recommended deleting your OAuth & start fresh with a new ID & the correct View ID info. This should work for you!

Edited by CRAEXIS (see edit history)
Link to comment
Share on other sites

Try leaving the homepage URL blank in the consent screen. What's the exact error your getting?

 

Haw you recommended I leave blank homepage URL, configurate module and click "Zapisz i Uwierzytelnij" (Save and check):

2c8f164613b93e51.jpg

 

And had error:

dd111abc82cb8b25.jpg

:(

 

Maby I write wrong adres URL in google app (Javascript Origins) ? 

Link to comment
Share on other sites

Hi,

 

I am getting these errors

Google is unreachable (check your firewall)

 

Google API Authorization granted but access token cannot be retrieved

 

Cannot retrieve test results

 

 

I am not sure why this is. Please help. I think is a server issues or something with permissions

 

Anyone know who to fix this?

 

Thanks

/Alex

Link to comment
Share on other sites

Hi,

 

I am getting these errors

Google is unreachable (check your firewall)

 

Google API Authorization granted but access token cannot be retrieved

 

Cannot retrieve test results

 

 

I am not sure why this is. Please help. I think is a server issues or something with permissions

 

Anyone know who to fix this?

 

Thanks

/Alex

The problem for me was the redirect link in the generation of api cred. was incorect. the good link is like in the image Capture.jpg

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

FIXED !

Only if you have "Cannot retrieve test results"

Look at this:

your.domain.com/modules/gapi/screenshots/3.0/Google%20API%20-%2010%20-%20Profile%20ID.png

Profile > This number from your GA page

 

Lo tengo hecho desde el principio. Settings saved Succsessful pero no recibo datos.

  • Like 1
Link to comment
Share on other sites

My configurate look like this:

 

dd92413b9f23171f.jpg

1de6a9d8d81bb8a9.jpg

 

and of course API analystic is ON.

 

In shop I copy:

ec06258a1fd6b03e.jpg

 

Profil I will copy from Analystic:

56b64f76b7f7751a.jpg

 

 

And when I click Save I have error:

 

cd4ef76ead506507.jpg

 

Please tell me when and what I do wrong ? :(

Link to comment
Share on other sites

My configurate look like this:

 

dd92413b9f23171f.jpg

1de6a9d8d81bb8a9.jpg

 

and of course API analystic is ON.

 

In shop I copy:

ec06258a1fd6b03e.jpg

 

Profil I will copy from Analystic:

56b64f76b7f7751a.jpg

 

 

And when I click Save I have error:

 

cd4ef76ead506507.jpg

 

Please tell me when and what I do wrong ? :(

You are using protocol HTTPS - Secure protocol

Delete that HTTPS an Write HTTP - No secure protocol that will work

You see that on the error 400 google cal to http no https

Edited by Milen (see edit history)
Link to comment
Share on other sites

you have to add correct profile to it, you can find it at analytics webpage, add those numbers from web browser after letter p.

 

Yes I finded correct profile. First I copied numbers like in instrucion prestashop (and have correct configurate, but error in download the information), but in second time I go to analystic page and copied ID my shop and ewerything works fine.

 

Ths

Link to comment
Share on other sites

Are you sure the analytics account with the view id has data?

 

One easy way also is to view source on your website and get the analytics UA-XXXX number and make sure that matches the project with the view ID pXXXXX you put in prestashop.

 

For me until I had data (24 hours after creating a new analytics project) then I also saw the "Cannot retrieve test results".

 

Peter

Edited by peterept (see edit history)
  • Like 1
Link to comment
Share on other sites

Do you have any data in your Google analytics account? For me until I had data (24 hours after creating a new analytics project) then I also saw the "Cannot retrieve test results".

 

Peter

Nope. left 2 days. All stats 0 0 0 . :(

Link to comment
Share on other sites

See my edit above. Can you confirm the UA-XXX analytics account has data in it when you log into Google Analytics?

 

In GA no have any data (all stats 0)

 

https://www.google.com/analytics/web/?authuser=0#report/visitors-overview/aSSSSSw######p8661XX57

 

This id i write to Presta. Not UA-5139XX44-1

 

In souce - i dont have any lines with this ids.

Edited by Cathode (see edit history)
Link to comment
Share on other sites

Yes, if you have no data in Google Analytics then prestashop will report the error you are seeing.

 

Your website needs to be uploading some data to GA (via the UA-XXXX) number.  (Using "Google Analytics" module).

 

Then you can retrieve that data via the View ID (using "Google Analytics API" module that you are doing now).

 

Once you have data from your website up in google that error will go away.(24 hours from when you start logging).

 

HTH,

 

Peter

  • Like 1
Link to comment
Share on other sites

Yes, if you have no data in Google Analytics then prestashop will report the error you are seeing.

 

Your website needs to be uploading some data to GA (via the UA-XXXX) number.  (Using "Google Analytics" module).

 

Then you can retrieve that data via the View ID (using "Google Analytics API" module that you are doing now).

 

Once you have data from your website up in google that error will go away.(24 hours from when you start logging).

 

HTH,

 

Peter

 

Okay. I turned on GA module, and write UA-XXX id. In source now i see this.

So waiting... Thx.

Link to comment
Share on other sites

I have the same problem, everything configured correctly , asked the access offline for retrieved data but always this red message:"Cannot retrieve test results"

 

What Can I do to fix it please?

Read upper posts by peterept.

Need configure GA module and wait 24 hours.

Link to comment
Share on other sites

  • 2 weeks later...

I do all with screen manual.

All done.

 

But cant fix problem.

 

Google API Authorization granted
×Cannot retrieve test results
 
 

 

All profile ids - write like says in manual.

 

In google api - stats show stats normally.

I have the same problem :o(

Link to comment
Share on other sites

I am getting these errors. Can anyone please help me sort this out too.
 
Google is unreachable (check your firewall)
 
 Google API Authorization granted but access token cannot be retrieved
 Cannot retrieve test results

 

Thanks

/Alex

Link to comment
Share on other sites

I would really love an answer to the original question on this thread from shahriar.

 

After following the instructions step by step, I continued to receive the "Cannot retrieve test results" error. However, simply waiting a day and trying again, it worked! I guess it just needed some tracking data.

 

So now it works.. but what does the GAPI module do?? The "Google Analytics" module adds the tracking code with your profile ID, so you can login to GA and see your site info. What then does the GAPI module do? I don't see a new menu or anything new in the BO.

  • Like 3
Link to comment
Share on other sites

FIXED !

Only if you have "Cannot retrieve test results"

Look at this:

your.domain.com/modules/gapi/screenshots/3.0/Google%20API%20-%2010%20-%20Profile%20ID.png

Profile > This number from your GA page

 

Thanks! You saved my day!

 

ps: prestashop 1.6.0.8 ga module 0.14, analytics api v.3.0.

Edited by ppokrovsky (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
Google API Authorization granted
×Cannot retrieve test results

Still have de same problem... i 've proved everything that you can find in internet

Tengo el mismo problema he probado de todo.. no hay manera..
 

 

Link to comment
Share on other sites

Hello , 

 

I installed and setup 

Google Analytics API  Module

 

Where can i see result , is it show in BO or i have to check on my analytics account ?

 

I didn't see an answer to the original question. How is it used/viewed? Or is it just enhancing the original GA module with better tracking?  If so, how?

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

I am getting these errors. Can anyone please help me sort this out too.

 

Google is unreachable (check your firewall)

 

 Google API Authorization granted but access token cannot be retrieved

 Cannot retrieve test results

 

Thanks

/Alex

Hi,

I'm also getting "Google API Authorization granted but access token cannot be retrieved" in www.puntosex.es

It would be great if this started working properly.

Prestashop team should tryy and make a better tutorial and explain were to get all the values and solution for the error we might get.

Thanks

Link to comment
Share on other sites

I guess my question is, WHAT SHOULD WE FILL IN THE "PROFILE" SECTION?

 

but,i am not sure,i need wait 24 hours to see whether it work out not,

 

i forget to put on the analytics code to the site,,,,,,,,,,,

 

 

 

--------------------------------------------------------------------

 

yes,it's just the problem,don't forget to put on the analyitcs code to your site,and it begin to gather the data,

Edited by NFDex (see edit history)
Link to comment
Share on other sites

  • 5 weeks later...
  • 4 weeks later...

Hi Everyone

 

I am using Prestashop 1.6.0.9 and have set up Google Analytics and the Google Analytics API. This might seem like a silly question but what exactly is the Google Analytics API module used for? What is the benefit of having it?

 

Thanks in advance for any light you can shed.

 

Julian

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I am using Prestashop 1.6.0.9 and have set up Google Analytics and the Google Analytics API. This might seem like a silly question but what exactly is the Google Analytics API module used for? What is the benefit of having it?

 

Thanks in advance for any light you can shed.

 

I have been looking fro an answer to this but am unable to find one.

 

I though it would allow me to see my GA stats without leaving Prestashop but apparently not.

Link to comment
Share on other sites

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

Hello,

 

I have the same problem...

Google API Authorization granted
Cannot retrieve test results
 
Permissions are ok, ganalytics is working and has data, my web site is linked to developers tools, allow_url_fopen=on in php configuration on host gives me server error. Everything seems to be as in all tutorials, but i get always same result... What can i do ?
Edited by berkis (see edit history)
Link to comment
Share on other sites

 

Hello,

 

I have the same problem...

Google API Authorization granted
Cannot retrieve test results
 
Permissions are ok, ganalytics is working and has data, my web site is linked to developers tools, allow_url_fopen=on in php configuration on host gives me server error. Everything seems to be as in all tutorials, but i get always same result... What can i do ?

 

 

Change your hosting server. I suggest Amazon. It gives you full control over permissions.

Link to comment
Share on other sites

  • 2 weeks later...

Hi I am getting Google API Authorization granted but access token cannot be retrieved

I think the problem is the multistore.

It seems like this google api module will only work with one store at a time.

Any ideas.

Thank you

Yes for me it was, when I filled in the detail under "all shops" it gives the error above, but when I switch to the specific shop it works (already granted).

I think presta is just not able to cope with multi shops in that respect (multistore overview on the dashboard)

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I think the problem is related with multishop / seo urls, In my case, I had no problems installing it on a sigle-shop prestashop, but when multishop is enabled, I never could install it.

I get the error "Cannot retrieve test results", because the module cant be confirmed with analytics. I tried with SEO urls enabled and disabled, configured the module for specific shops, all shops, group shops, but not results.

Link to comment
Share on other sites

  • 2 months later...

Is there an alternate way to pull figures in to the store BO apart from the PS module. .?

Having had it all running for ages it suddenly stopped pulling figures in. Analytics page still providing visitor data but i don't have the energy or patience to get the PS api working again. Spent maybe 20+ hours since the 5th july when it stopped working. Still cannot get it running again now and just get the url mismatch error. Beginning to think there is something blocking the link but ive tried 644 and 755 on gapi and the oauth2 itself. Im completely baffled now as to what stopped it working and what setting might need adjusting to grt it back again :(. Alternative would be great :)

Link to comment
Share on other sites

  • 1 month later...

If you have multistore , I found that you need to login to the admin under each specific domain you want to use, otherwise google will not recognise the URL you are trying to link up to. 

 

But what if all my multistore instances are located on same domain in subdirectories???

Link to comment
Share on other sites

  • 4 weeks later...

Excuse me, also I have problems with GOOGLE ANALYTICS but my error is this. Thank you.

 

400. That’s an error.

 

Error: invalid_request

Invalid parameter value for redirect_uri: Missing scheme: modules/gapi/oauth2callback.php

Learn more

Request Details

That’s all we know.

Link to comment
Share on other sites

Excuse me, also I have problems with GOOGLE ANALYTICS but my error is this. Thank you.

 

400. That’s an error.

 

Error: invalid_request

Invalid parameter value for redirect_uri: Missing scheme: modules/gapi/oauth2callback.php

Learn more

Request Details

That’s all we know.

Link to comment
Share on other sites

  • 2 months later...

 

Excuse me, also I have problems with GOOGLE ANALYTICS but my error is this. Thank you.

 

400. That’s an error.

 

Error: invalid_request

Invalid parameter value for redirect_uri: Missing scheme: modules/gapi/oauth2callback.php

Learn more

Request Details

That’s all we know.

 

I have same problem. I set API and everything but i have a same error

Link to comment
Share on other sites

  • 4 months later...

FIXED !

Only if you have "Cannot retrieve test results"

Look at this:

your.domain.com/modules/gapi/screenshots/3.0/Google%20API%20-%2010%20-%20Profile%20ID.png

Profile > This number from your GA page

 

Thank you! This fixed the problem for me.

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
  • 11 months later...
  • 4 weeks later...

Hi,

Can anyoane help me with this error i recived with google analytics module

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: name

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: name

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: columnType

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: columnType

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: dataType

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: dataType

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: name

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: name

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: columnType

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: columnType

Notice on line 397 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: dataType

Notice on line 399 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: dataType

Notice on line 233 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: visits

Notice on line 233 in file /home/accesor2/public_html/modules/gapi/gapi.php
[8] Undefined index: uniquePageviews

Link to comment
Share on other sites

×
×
  • Create New...