I'm wanting to plug the Google Analytics (GA) API into a dashboard I'm building.
The GA API's are available in JAVA, Phython, PHP, and JavaScript. So as Squiz Matrix is a CMS, then I can't use the code versions, which only leaves me the JavaScript version.
Problem: Cross site scripting.
I guess there will be an issue from the start because to use GA API properly I'm gonna need some communication between my page and GA.
Has anyone tried this and how do you see me getting around this?
I'm new to API's and connections, so if anyone has some suggestions or tutorials please help me out.
If you are on 4.16+ you can use the Oath2 asset to create a connection to Google Analytics and make rest calls with a JS REST asset to grab any info you want from them.
Did you end up getting anywhere with the JS solution? If you've made any progress I'd be interested, because I have some similar problems with a solution I'm working on for online ordering system. I need to POST via JS to an external webservice.
Did you end up getting anywhere with the JS solution? If you've made any progress I'd be interested, because I have some similar problems with a solution I'm working on for online ordering system. I need to POST via JS to an external webservice.
TIA
Michael
I assume what Bart meant is use the rest resource javascript asset as an intermediary - you post the the rest js asset, it runs a javascript post serverside to the external server and then returns the result to the client - thus avoiding XSS issues as the only clientside POST is to your own rest asset.
Thanks for reply J.P. I understand the concept of using the REST JS resource asset as a "proxy" between the client making the XHR request, and the end point to which the post will be going. However, the problem is I don't understand the mechanism within Matrix to forward on the form data (that is posted by the XHR object to the proxy REST asset) to the externally hosted webservice. I can't find any useful examples in the Matrix manual to explain this concept.