Accessing Data API from Flex/Actionscript

133 views
Skip to first unread message

benz

unread,
Jul 21, 2009, 4:49:39 PM7/21/09
to google-analytics-api - GA Data Export API
Hey,

it seems like currently the Data API is not usable from Flex/Flash
applications.
This is a pitty because one could do wonderful things with this ;-)
So I`m wondering if someone from google could answer me if it would be
possible for them to provide a crossdomain.xml policy file with
<allow-http-request-headers-from domain="*" headers="*" secure="true"/
>

is there any reason not to allow this?

Thanks
Benz

Nick

unread,
Jul 22, 2009, 7:01:37 PM7/22/09
to google-analytics-api - GA Data Export API
Hey There,

Accessing data directly from Flash/Flex would indeed be big :)

Unfortunately exposing a crossdomain.xml file to allow this is also a
big issue and currently not supported at this time. One option is to
create a server side proxy which could send data to ActionScript.

Also, if you're building an AIR app, crossdomain.xml isn't required.

-Nick

Nick Green

unread,
Aug 3, 2009, 5:04:12 PM8/3/09
to google-analytics-api - GA Data Export API
Could you elaborate on what you mean by sever side proxy? I thnk
you're referring to PHP, but server side programming is an area where
I'm very much lacking. I found a post at
http://www.zedia.net/2009/how-to-connect-to-google-analytics-data-api-in-flash/
describing how to work with PHP to get around the crossdomain issue.
But I continually get errors with the curl.php files that don't make
sense. Are there non-Curl methods of doing this?

Any help would be appreciated.

On Jul 22, 6:01 pm, Nick wrote:
> Hey There,
>
> Accessing data directly from Flash/Flexwould indeed be big :)

Nick

unread,
Aug 4, 2009, 2:10:05 PM8/4/09
to google-analytics-api - GA Data Export API
Hey Nick,

So the problem from getting GA API data directly from Flash today is
that the Google Analytics API doesn't support a cross domain file.

What you will have to do make your API requests from a server (as a
proxy) then send the responses back to your Flash program. You can do
this in PHP, Python, Java, etc...There are a couple of easy to use
libraries that can get you started here :
http://code.google.com/apis/analytics/docs/gdata/gdataLibraries.html

-Nick


On Aug 3, 2:04 pm, Nick Green wrote:
> Could you elaborate on what you mean by sever side proxy?  I thnk
> you're referring to PHP, but server side programming is an area where
> I'm very much lacking.  I found a post athttp://www.zedia.net/2009/how-to-connect-to-google-analytics-data-api...

MarkA

unread,
Aug 11, 2009, 12:00:21 PM8/11/09
to google-analytics-api - GA Data Export API
Can you tell me how I set the auth token in AIR? When I apply the auth
key as is an error occurs:
The HTTP request header GoogleLogin Auth=[xyz] cannot be set via
ActionScript

When I shorten the token by encoding it base64 it works, but there the
google api cannot
work with it.



On 23 Jul., 01:01, Nick wrote:
> Hey There,
>
> Accessing data directly from Flash/Flexwould indeed be big :)
>
> Unfortunately exposing a crossdomain.xml file to allow this is also a
> big issue and currently not supported at this time. One option is to
> create a server side proxy which could send data to ActionScript.
>
> Also, if you're building anAIRapp, crossdomain.xml isn't required.

Nick

unread,
Aug 12, 2009, 8:37:35 PM8/12/09
to google-analytics-api - GA Data Export API
hmm...I'm not sure Nico @ Desktop reporting got this working.

I would start by verifying you are indeed using the right data for the
AuthToken it sounds like what you are using for XYZ is too long.

-Nick

Nick

unread,
Sep 3, 2009, 4:23:24 PM9/3/09
to google-analytics-api - GA Data Export API
Show your support for this feature here Benz:
http://code.google.com/p/gdata-issues/issues/detail?id=1439&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary

-Nick

On Jul 21, 1:49 pm, benz wrote:

lecochien

unread,
Sep 11, 2009, 5:00:51 AM9/11/09
to google-analytics-api - GA Data Export API
@Nick
you say "Also, if you're building an AIR app, crossdomain.xml isn't
required. "
Air embed webkit and there is some security consideration like this
one
"Dynamically created script elements, such as when created with
innerHTML or document.createElement() method are ignored." (http://
livedocs.adobe.com/flex/3/html/help.html?
content=ProgrammingHTMLAndJavaScript_03.html#1038897)

so as jsapi use this to load external script (ie : "d=o.createElement
("script");d.type="text/javascript";d.src=b") we can't use Air in
javascript mode.

It's my opinion.
Bye !

Nick

unread,
Sep 11, 2009, 3:56:38 PM9/11/09
to google-analytics-api - GA Data Export API
Hi correct,

If you are building an AIR app, you will need to make HTTP requests
directly to our API and will not be able to use the jsapi.
-Nick
Reply all
Reply to author
Forward
0 new messages