Jump to content

Google Analytics API v3.0


Jeffro

Recommended Posts

Hi,

I had the same issue and I've solved in the following way:

 

1) I've created a new api project.

2) Go to APIs&auth-> Credentials and click on Create new client id (See img).

3) Application Type: Web Application and add the shop url with and without 'www' (See img) and save all.

4) Go to Consent Screen and insert your data (see img) and save.

 

At this point go on your BO, insert your Client ID, Client Secret and profile number, save and done.

 

Sorry for my english :P

 

Thanks it worked

Link to comment
Share on other sites

Maybe you can try my solution, it's work with My Shop PS 1.6.0.9 and GOOGLE ANALYTICS API V3.0

 

In My Google Analytics Api Configuration

ID Client : MyIdClient.apps.googleusercontent.com
Client Secret : MyClientSecret
Profile : XXXXXXXX --> 8 Digits in Google Analytics --> Admin --> Views Setting 

Screenshots:

 

attachicon.gifprofile google analytics module.png

 

Your screen shot made me realize that the whole time I had entered my profile ID starting with a "p" - I removed the "p" and now everything works! Silly mistake of mine!

  • Like 2
Link to comment
Share on other sites

In my case no matter what I do... I always get:

 

Error: redirect_uri_mismatch

 

Prestashop 1.6.0.9

 

In My Google Analytics Api Configuration:

 

ID Client : MyIdClient.apps.googleusercontent.com
Client Secret : MyClientSecret
Profile : XXXXXXXX --> 8 Digits in Google Analytics --> Admin --> Views Setting 

 

I fill the fields following the previous info...

 

:(

Link to comment
Share on other sites

In my case no matter what I do... I always get:

 

Error: redirect_uri_mismatch

 

Prestashop 1.6.0.9

 

In My Google Analytics Api Configuration:

 

ID Client : MyIdClient.apps.googleusercontent.com

Client Secret : MyClientSecret

Profile : XXXXXXXX --> 8 Digits in Google Analytics --> Admin --> Views Setting 

 

I fill the fields following the previous info...

 

:(

 

Have you tried setting up the URL in the API with our without https? And if your Prestashop is installed in a subfolder, you must make sure to include that in the URL too.

Link to comment
Share on other sites

This definitely works, but it requires everything to be done - folks with the errors are missing steps:

https://console.developers.google.com

- create Project
> APIs
>> add Analytics API (you can remove the other default ones that are "on"
> Credentials
>> Redirect URIs ex:

 

 

>> JavaScript Origins ex:
 

 

>> Consent Screen (important - will not work without this!)
 

Fill out all non-optional information in the form and save.

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

Prestashop Back Office

 

Modules >

 

- Filter by Installed & Not Installed and Enabled & Disbaled

- search for google

- Install Google Analytics 1.x by Prestashop and configure

- add your user agent from Google Analytics website, ex : UA-1234567-1 - it's visible on the Home tab and several sub menus

- check Universal box and hit save/update

Modules >

 

- now do the Google Analytics API module config with the previous data

_______________________

 

You will always get an error about the data, as it takes a variable amount of time for it start pushing out via the API calls - all Google Analytics tie-ins are subject to this. You can make sure you are collecting data by going to the Google Analytics site and drilling down to Real Time > Overview, which will show live traffic to your site.

Link to comment
Share on other sites

obviously the problem is true. in the prestashop issue tracker there's not issues about that.

 

but I'm absolutely sure the me and you did exactly the right operations. 

 

so I suggest you to analyze that row that get zero data: in gapi.php

 

227: $result_test = $this->api_3_0_requestReportData('', 'ga:visits,ga:uniquePageviews', date('Y-m-d', strtotime('-1 day')), date('Y-m-d', strtotime('-1 day')), null, null, 1, 1);

 

 

 

let's start within it

  • Like 1
Link to comment
Share on other sites

not enough.. 

I had only one time a GAPI running.. it was in july.

after that.. I reinstalled 8 times my web from scratch. It tools 2 months

 

I did all of possible variations .. but I never have reached my goal.

 

and using 1.8.2 older gapi.. gave any better results.

 

i'm so sad.. in my DB with phpmyadmin I discovered that the gapi configuration is fine.. and I saw also the 2 Google secret keys (auth code and token) so I'm sure the grant is satisfied. but there's no way to retrieve data.

 

bad code.. this GAPI. 

Link to comment
Share on other sites

I cannot find my Google Analytics API module anymore. I used to have it and it was working fine but now it has disappeared and I cannot find a new one in either the Addons marketplace or when I search the web. I have the Google Analytics v1.8.2 module set up correctly with the proper user ID but I am at a loss as to where the Google Analytics API module has gone. Can anyone help me find the gapi module or send me a new one so I can use Google Analytics API on my site again.

Link to comment
Share on other sites

thanks 

meanwhile these 2 days I tested an older version on google analytics module.. the 1.4.3 (found in another forum)

and I can DECLARE that it run

 

recent 1.8.x version not

.

now I'm trying your attachment

 

 

but

 

the folder NOTES

with your file

dwsync.xml

 

is relevant??

 

___

 

GREAT WORKS (only miss is in dashboard frontpage but statistics work)

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

Question:

Can i use the standard view(All website data) - created automatically - and use this ID as well?

This view works for me at the analytics pages like charm.

Or do i need this view to be conected with the Analytics API?

Link to comment
Share on other sites

can someone please put together a guide once you get this figured out so that many of us can set this up.  

 

i am a google noob lol... i mean i know how to set up a basic analytics account but when it come to all this oauth and special secrets and apps and redirects im a total noob.

 

I did do that oauth2 and set it to yes, i also found my id and my profile number.   But as far as the secret im totally lost.  

 

Can someone please do a simple guide... thanks 

Link to comment
Share on other sites

You can find your profile ID in the address bar of your browser while accessing Analytics report.

For the OLD VERSION analytics page the ID=xxxxxxxx is the following:

https://www.google.com/analytics/reporting/?reset=1&id=XXXXXXXX&pdr=20110702-20110801

For the NEW VERSION analytic page it is the number at the end of the URL starting with p:

https://www.google.com/analytics/web/#home/a11345062w43527078pXXXXXXXX/

 

Still the same error what now?

Link to comment
Share on other sites

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

 

Salut depuis -> https://console.developers.google.com

-creer un nouveau projet

-renseigner bien les zone content screen comme dit plus haut par Damien Metzger

-Activer votre Api

-Credential créer un nouveau client ID

-Rensigner bien et attention dans le tuto les champ Authorized JavaScript origins et Authorized redirect URI sont inversé !

-Copier depuis le nouveau bloc créer le client ID et client SECRET

-Copier les chiffre figurant dans l'URL qui succedent la lettre p= comme indiquer depuis le tutohttps://www.google.c...alytics/p=00000 ces chifre represente le Profil

- On a donc bien nos 3 champs a remplir dans notre module API Google Analytics v3.0

 

PS :perso pour credential nouveau ID j'ai renseigner le champ Authorized redirect URI par http://your_domain_name.com/modules/gapi/oauth2callback.php mentionné plus haut par cinnamong. j'utilise

cette solution à marché pour moi...

http://your_domain_name.com/modules/gapi/oauth2callback.php dans redirect URI

 

merci!!!

Link to comment
Share on other sites

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

Hi,

I had the same issue and I've solved in the following way:

 

1) I've created a new api project.

2) Go to APIs&auth-> Credentials and click on Create new client id (See img).

3) Application Type: Web Application and add the shop url with and without 'www' (See img) and save all.

4) Go to Consent Screen and insert your data (see img) and save.

 

At this point go on your BO, insert your Client ID, Client Secret and profile number, save and done.

 

Sorry for my english :P

 

 

 

I  have configure like this, buy doesn't work for me, i have PS 1.6.0.9.

Google API Authorization granted
×Cannot retrieve test results

 

have one question:

 

to work, ait  must be my site on url_fopen ???

because my site is Sharing the side and told me that being shared server can not have url_fopen.

 

 

is it the usual ?? and can be this the reasin ??

 

thanks and excuseme for my english

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

It really doesn't seem like this should be this difficult.  I'm new to Prestashop but not new to Google analytics or shopping carts.  I have now spent several hours (more out of stuborness) to figure this out.  I would vote that the Presta Shop team needs to either figure out a better alternative or give more in dept instructions.

Link to comment
Share on other sites

I  have configure like this, buy doesn't work for me, i have PS 1.6.0.9.

Google API Authorization granted
×Cannot retrieve test results

 

have one question:

 

to work, ait  must be my site on url_fopen ???

because my site is Sharing the side and told me that being shared server can not have url_fopen.

 

 

is it the usual ?? and can be this the reasin ??

 

thanks and excuseme for my english

Je te réponds en françaisj'espère que c'est bien ta langue d'origine. Quand tu vas dans "Go to APIs&auth", fais attention à l'adresse du site, si c'est http://monsite.com... et que tu vois http://www.monsite.com... enlève le www.

 

 

Si ça peut aider, c'est comme ça que j'ai finalement obtenu le feu vert de ganalytics, d'ailleurs quand cela fonctionne, tu arrives direct sur une page de "Félicitations" qui dit en gros que tu as bien tout configuré.

 

Il reste toujours un problème entre paypal, ganalytics et prestashop parce que je ne vois pas mes ventes dans Prestashop ni dans l'E-commerce de ganalytics mais bon ... D'ailleurs si quelqu'un à une solution je suis preneuse voici la référence du bug dans la forge : http://forge.prestashop.com/browse/PNM-3142

 

Linda.

Link to comment
Share on other sites

I have a doubt because in the prestashop modul API configuration, tell the url to put on the URI, in my case is:

  http://www.myweb.com/modules/gapi/oauth2callback.php

 

but in the GOOGLE APIS configurations, tell : no relative path

 

error-uri_1.jpg

 

 

 

 

but the   http://www.myweb.com/modules/gapi/oauth2callback.php  but i'ts  a path .... isn't ???

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

I have a doubt because in the prestashop modul API configuration, tell the url to put on the URI, in my case is:

  http://www.myweb.com/modules/gapi/oauth2callback.php

 

but in the GOOGLE APIS configurations, tell : no relative path

 

error-uri_1.jpg

 

 

 

 

but the   http://www.myweb.com/modules/gapi/oauth2callback.php  but i'ts  a path .... isn't ???

Hello Jonysi_d,

 

I'll try to answer in english but remember that's it's not my usual language. My english is not good so I'm not very clear, you are right if you have www. you should write www. it's what I'll try to tell you but my explication was too complicated, sorry. So for that, it's ok.

 

I think you have already check my solutions but who know ? There is a lot of indication and at the end we are lost, no?

 

1a-You can go in App Google analytics/Admin in the "Paramètres de la vue/View parameters" the url of your site web :

URL of web site

Check again for your "http://www."

 

1b- It's not for you but for the others beginners who have perhaps an url adress like me http://mywebsite.org""

or http://www.mywebsite.com"

or "https://wwwmywebsite.com."

or "http://mywebsite.com" ...

you must write exactly YOUR website's url

 

2a--You can also check that in API Google analytics on Prestashop at "ID client" you have to take the first line who is finish by :

ID Client ...apps.googleusercontent.com

 

2b-For "Secret client" you have to take the third line.

 

2c--In the "Google Analytics Tracking ID" of Google analytics AND in "Profil" of API Google analytics have you check that you have the same numbers ? It's the numbers that you can find after the "P" in the url adress of your app Google analyttics like that :

https://www.google.com/analytics/web/?authuser=...2389p945....6...

 

 

I hope you will understand what I try to say and you will succeed (let us know),

Linda.

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

hi Linda...

 

 

 

Hello Jonysi_d,

 

I'll try to answer in english but remember that's it's not my usual language. My english is not good so I'm not very clear, you are right if you have www. you should write www. it's what I'll try to tell you but my explication was too complicated, sorry. So for that, it's ok.

 

I think you have already check my solutions but who know ? There is a lot of indication and at the end we are lost, no?

 

1a-You can go in App Google analytics/Admin in the "Paramètres de la vue/View parameters" the url of your site web :

URL of web site

Check again for your "http://www."

 

1b- It's not for you but for the others beginners who have perhaps an url adress like me http://mywebsite.org""

or http://www.mywebsite.com"

or "https://wwwmywebsite.com."

or "http://mywebsite.com" ...

you must write exactly YOUR website's url

 

2a--You can also check that in API Google analytics on Prestashop at "ID client" you have to take the first line who is finish by :

ID Client ...apps.googleusercontent.com

 

2b-For "Secret client" you have to take the third line.

 

2c--In the "Google Analytics Tracking ID" of Google analytics AND in "Profil" of API Google analytics have you check that you have the same numbers ? It's the numbers that you can find after the "P" in the url adress of your app Google analyttics like that :

https://www.google.com/analytics/web/?authuser=...2389p945....6...

 

 

I hope you will understand what I try to say and you will succeed (let us know),

Linda.

 

excume, I don't undertand the 2c ( where can I check my profil API ( same number of google analytics ) ???

 

 

ohh... you english is better than mine..!!!  :-)

Link to comment
Share on other sites

hi Linda...

 

 

 

 

excume, I don't undertand the 2c ( where can I check my profil API ( same number of google analytics ) ???

 

 

ohh... you english is better than mine..!!!  :-)

 

Hi Jonysi,

 

Sorry I can't answer you before : I've a problem with Ganalytics (hahaha Google analytics is really a joker no?) it's not working  anymore ... I think it's good idea like "Bcolflesh" to install the last version of Prestashop 1.6.0.11.

 

For the 2c :

In API Google Analytics, click on v1.3 and you can read in your language how find your profil. It's numbers after "p" when you are going in Google Analytics on the web, you see? I copy in french. After you return on V3.0 and you write the settings. I think you use the last version (2) if not read the indications for the (1) old version.

 

"Quelle version de l'API Google Analytics voulez-vous utiliser?

v1.3 : facile à configurer mais dépréciée et moins sécurisée

v3.0 : avec OAuth 2.0, la plus puissante et la plus récente

Vous trouverez l'identifiant de profil ("Profile ID") dans la barre d'adresse de votre navigateur lorsque vous consultez le rapport sur le site de Google Analytics.

 

(1) Pour l'ANCIENNE version de Google Analytics, l'ID du profil est dans le paramètre "id" de l'URL (voir "&id=xxxxxxxx") :

https://www.google.com/analytics/reporting/?reset=1&id=XXXXXXXX&pdr=20110702-20110801

 

(2) Pour la NOUVELLE VERSION de Google Analytics, l'ID du profile est le numéro situé à la fin de l'adresse, commençant par un p :

https://www.google.com/analytics/web/#home/a11345062w43527078pXXXXXXXX/"

 

So I going to try to updated Prestashop and will see. Tell me if it's ok for you.

 

Best regards,

Linda.

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

  • 2 weeks later...

Yo estoy igual que algunos anteriores. 

 

Tengo mi cuenta de API creada desde hace meses, también Analytics. 

Ha estado funcionando un tiempo, pero dejo de monitorizar hace unos días. 

He leído el foro, y no veo que estoy haciendo mal. 

El módulo es Google Analytics API v1.0.3. Tengo incluida en la Analytics API la información de Client ID, Client Secret. Tambien tengo incuido el ID Vista de Analytics 9xxxxxxx. He probado a regenerar la clave secreta de la API, pero siempre me muestra el mensaje siguiente: 

 

Error: redirect_uri_mismatch

Application: Tus Perfumes Online

You can email the developer of this application at:[email protected]

The redirect URI in the request: http://www.tusperfumesonline.com/modules/gapi/oauth2callback.php did not match a registered redirect URI.

Ya no se que probar. 

También he intentado incluir el codigo ID Seguimiento (UA-xxxxxxxx-1) en el módulo Google Analytics v2.0.5, pero tampoco me muestra nada en tiempo real, por ejemplo, ni en el contador de visitas. 

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

  • 2 weeks later...

I am having trouble setting this up. I have the Client ID and Client Secret but I am not sure what to put in the Profile field.

 

Please help.

 

Error: redirect_uri_mismatch

The redirect URI in the request: http://www.simplcig.com/Simpl/modules/gapi/oauth2callback.php did not match a registered redirect URI

 

I solved that problem by logging out from all my Google Account, and then login with the only one interested in this procedure.

Link to comment
Share on other sites

×
×
  • Create New...