googleanalytics / google-analytics-super-proxy

Publicly share your Google Analytics reporting data.
Other
224 stars 99 forks source link

Unable to get JSON query with jQuery #27

Open ghost opened 10 years ago

ghost commented 10 years ago

I am getting an error that says: No 'Access-Control-Allow-Origin' header is present on the requested resource

I have been looking for the file I need to edit to make it so I can pull the Query data using jQuery, but I can't find it.

I am using this to populate a dashboard that is client friendly, and without this feature, I can't use the SuperProxy. Please let me know what file I need to update, or push an update allowing us to grab the file using jQuery!

pfrisella commented 10 years ago

what does the request look like? callbacks are supported, have you tried using that?

ghost commented 10 years ago
$.get('https://*****.appspot.com/query?id=ag5zfmNtc3VwZXJwcm94eXIVCxIIQXBpUXVlcnkYgICAgIDDlQoM', function(data) {....

I am requesting with jQuery through the $.get function. Should I be using $.getJSON, or something different? I am using jQuery so the data reloads every 2 minutes.

ghost commented 10 years ago

Any more information you can give? I would love to use SuperProxy, but if this is what is going to be happening, I can't use it.

WillemPaling commented 10 years ago

I had the same problem. I had to modify the python code to set the 'Access-Control-Allow-Origin' header.

WillemPaling commented 10 years ago

I've resolved the issue in my fork: https://github.com/WillemPaling/google-analytics-super-proxy

Chris-Barber commented 10 years ago

Hi, I have been having the same issue as RageQuit. WillemPaling I downloaded your fork but there is no config.py?

WillemPaling commented 10 years ago

Use the config.py from the main fork. I removed it because it had my login details in it :) I'll fix it up...but that should get you going in the meantime.

Chris-Barber commented 10 years ago

I wondered if that was the case. Thanks for you quick response.

Chris-Barber commented 10 years ago

I have updated the config and re-deployed with app launcher. However, I am still getting the same issue.

405 (Method Not Allowed) No 'Access-Control-Allow-Origin' header is present on the requested resource.

Using: $.ajax({ url: url, cache: false, success: function (data) { handleData(data); } });

Any ideas how to overcome this?

WillemPaling commented 10 years ago

I had to change the version number in the app.yaml, and redeploy the app. Then go into Google App Engine, go to Versions, then set the new version as the default.

Chris-Barber commented 10 years ago

Thanks! You are legendary! It worked like a charm.

WillemPaling commented 10 years ago

Good to hear it's working.