Since we are doing a cross origin JSON request, and GAS does not support CORS, we have to use JSONP. To know more about JSONP see JSONP and JSON and Google Apps Script webapps.
Here’s an example of a very simple non blocking JSONP implementation.
We need to pass the current page to Retrieving page data from GAS web service we need to figure out what page we are on. Since gadgets run in an Iframe, document.referrer will be pointing to the current page. Passing this will cause a JSONP response with the stats for that page.

See more like this in  Displaying analytics data on site pages