Google analytics reporting

Hi everybody

I am have a php program that pulls info from google analytics and presents it to the customer.

Google has a few samples here https://developers.google.com/analytics/solutions/articles/hello-analytics-api and as you can see there are demos for Python, Java, PHP and javascript.

I would like to redo it in Xojo, but I have no idea how to pull that off. Google developed libraries for objects in those languages already.

What do you think?

[quote=122886:@Andres Montoya]I would like to redo it in Xojo, but I have no idea how to pull that off. Google developed libraries for objects in those languages already.
[/quote]

From a quick look at the PHP, it seems possible to interface with the API using an HTTPSocket.

But the quickest route could simply be to execute the JavaScript example in a WebHTMLViewer.

how can we extract info from the WebHTMLViewer after it executes then? Because I could get it to run the queries but I need to get the json response and parse it to display the results on the xojo components.

You can always push JavaScript variables back to Xojo through changing the hashtag which is then available in the WebSession HashTagChanged event. Looks feasible by modifying the section 4. Output the result of the Javascript example posted at the GA site.

@Andres Montoya - I suggest that you use the HTTPSecureSocket and make your calls directly to their API from the server app. Otherwise you’ll be pinging Google from everyone’s browsers.

my difficulty is on the oauth 2.0 using the rest api as documentation at google is mushy.

I am supposed to get a token, which it looks that I can and then I have to submit the request and send the token as part of the request but it is not real easy.

This sample here looks promising (php but uses the REST directly) http://www.visualab.org/index.php/using-google-rest-api-for-analytics

The thing is that they use CURL which is not available here and I was wondering how to do it using the regular REST api.

I’ve used the curlMBS plugin to do oauth 2.0 in the past and it was fairly easy as all the examples I found use curl.

Why is it that MBS have the components we would like built into Xojo :s

I will give it a try!