URL Shortener Service

The URL Shortener service allows you to use the URL Shortener API in Apps Script. This API gives users the ability to manage and report on their goo.gl short links.


For detailed information on this service, see the reference documentation for the URL Shortener API. Like all advanced services in Apps Script, the URL Shortener service uses the same objects, methods, and parameters as the public API.

Sample code

The sample code below uses version 1 of the API.

Get clicks

This sample gets the number of clicks the short URL received in the last week.

 * Logs the number of clicks to a short URL over the last week.
 * @param  {string} shortUrl The short URL.
function getClicks(shortUrl) {
  var url = UrlShortener.Url.get(shortUrl, {
    projection: 'ANALYTICS_CLICKS'
  Logger.log('The URL received %s clicks this week.', url.analytics.week.shortUrlClicks);

다음에 대한 의견 보내기...

도움이 필요하시나요? 지원 페이지를 방문하세요.