You can shorten any URL by placing the following code in the appropriate controller file. It can be used in both admin as well as catalog (store front)
[cc lang=”php”]$this->url->shorten(‘Your Long URL here’, $this->config->get(‘google_urlshortener_api’), $this->config->get(‘google_urlshortener_logs’));[/cc]
Example
$this->url->shorten('https://www.huntbee.com/resources/', $this->config->get('google_urlshortener_api'), $this->config->get('google_urlshortener_logs'));
Note: If API key is incorrect or not properly setup, then the above code will return the input URL.