1

I am trying to create a website where a user can sign up for the site (with a master username and password) and enter account information for various services, Google (anayltics, adwords) and non google (hootsuite).

Once they have created their account and logged in, it will take them to a custom page displaying their data from the various services.

I have created a Google Console Developer account and created the credentials (API keys, 0Auth2.0 client ids, and a service account.)

How I will access the users' custom data? The information I entered when setting up the credentials pertained to the server my website is hosted on. When I call the API won't I be getting data on my own website?

Which ID will I use to access the users' data like their Audience overview? Will I need their Google account information to be stored (username and password) or will username be enough? I haven't been able to find this information reading the beginners guides nor on YouTube.

Community
  • 1
  • 1
  • 2
    I just built something similar. you will need to create a login structure and pass session vars to the sections you want to inject their 'data' points. You will also want to do possibly a curl json get request from the sources you're after if they allow. – levi Nov 20 '15 at 05:47
  • Thanks for the response! So do I need to enter any information about their site(like the url) when signing up for google console developer or will I be able to access their data with session variables and the API alone? – onebadbaggins Nov 20 '15 at 05:52
  • Im confused. Are you trying to build a web based application, or are you trying to build another form of a application? – levi Nov 20 '15 at 05:54
  • web based. I'm mostly confused on setting up the API and how I can get the the users information. I already have a login in structure where the user can enter their google account information. When I use my API id and auth2.0 client Id won't I just be getting information on the domain I registered in the console? I'm not sure if I am being clear. – onebadbaggins Nov 20 '15 at 06:01
  • do you have gmail? If so do you want to jump into a chat? – levi Nov 20 '15 at 06:06
  • Yes! My gmail is arsingh2@asu.edu – onebadbaggins Nov 20 '15 at 14:24
  • @LeviZoesch could we get an answer? I'm curious as well – jaggedsoft Nov 21 '15 at 03:15
  • Give me a bit stuck in traffic and I'll type up some core steps needed. Sorry for the delay. – levi Nov 21 '15 at 03:21
  • 1
    First and foremost for the both of you. You need to identify what is it exactly you're trying to do? You then need to break that up into chunks of tasks youre trying to accomplish. If you're trying to pass user information to the website as the user is logged in (Ie; User logs in, views google map, they only see what is specified to them kind of thing) you will need to pass SESSION keys to retrieve the values per user. From there you can do a lot. – levi Nov 21 '15 at 03:53
  • 1
    However, I read your question and not sure eactly what you're trying to accomplish. If you're trying to retrieve data from Google, into your server you need to do some reasrch and figure out how Gogle allows data to be transfered. If its a simple JSON output file you can get from Google for your db values etc (or what ever you're looking for) you can do a simple CURL retrieve and import into your DB. You then would want to setup a CRON job to have that file ran every x minutes/days/weeks/months etc. @onebadbaggins – levi Nov 21 '15 at 03:53
  • If you can update your question a little bit to what exactly you're trying to do at this point in your build I can possibly steer you in the right direction. @NextLocal – levi Nov 21 '15 at 03:53
  • @LeviZoesch I have over 30 websites (all on the same google account and same analytics ID) and I'd like to fetch the totals for every website instead of getting them one at a time. I should probably post this as a bounty question. I know how to do it by grabbing them 1 at a time and then aggregating the json but the requests take forever. I want to do this for both Google Analytics and Google Search Console – jaggedsoft Nov 21 '15 at 04:01
  • 1
    @NextLocal why not do a cURL requests, and setup a CRON job to do it every specified time range. You can then inject the data points you're after by querying only those key:values into your DB then do a php request from your server db to output in a fancy little div table of the values youre after on each of the google api tables ? – levi Nov 21 '15 at 04:03
  • 1
    Can you have your analytic reports and google account information import into a Fusion table, then query that table onto your server ? https://developers.google.com/fusiontables/docs/v1/using – levi Nov 21 '15 at 04:04
  • 1
    Actually here is something someone id doing kind of similar I believe to wha tyou're trying to do @NextLocal http://stackoverflow.com/questions/33839588/google-charts-google-sheets-specified-range-does-not-identify-data-correctly – levi Nov 21 '15 at 04:06
  • 1
    Here is also how to data query from google https://developers.google.com/chart/interactive/docs/queries and here is how to connect to your DB from google services... https://developers.google.com/chart/interactive/docs/php_example – levi Nov 21 '15 at 04:07
  • @LeviZoesch Fusion tables isnt a bad idea. I think the best solution is like you said just do it 1 at a time for every website with a cron job and then total everything up yourself. Thanks for your help bud, I'll send you some reputation tomorrow – jaggedsoft Nov 21 '15 at 04:09
  • You could do individual cron jobs, but I would recommend 1 pull per x time. That way its one file for maintence, and just easier to trouble shoot instead of having 30 different cron jobs, could shoot yourself later lol @NextLocal – levi Nov 21 '15 at 04:11
  • 1
    Yeah seriously. The DRY method is best. Don't Repeat Yourself. Using that philosophy you try and reuse as much code as possible so stuff is always easy to work on. Thanks again bud, enjoy your night – jaggedsoft Nov 21 '15 at 04:12
  • HI guys. So this is exactly what I am trying to do. I have a website that I am creating lets call it websiteA.com. I want the user to be able to enter their google analytics account information(username and password) as part of their login information upon registration. Once they are register and login to my website (websiteA.com) I want them to be able to see the google analytics data for their own website (websiteB.com) – onebadbaggins Nov 21 '15 at 16:05

0 Answers0