Goo.gl Shortlinks

The default method of WordPress’ implementation of shortlinks adds ?p={post-id} to the end of your site name in place of the full URL. Though this can indeed shorten your link quite significantly; if you have a long site name it still might not be as effective.

This WordPress plug-in allows automatic url shortening of post links with goo.gl URL Shortener using the API recently provided by Google in place of the default ?p={post-id}.

For Example:
WordPress “shortlink”: http://christophercochran.me/?p=47 (not so short is it?)
shortlink created with the goo.gl API : http://goo.gl/Tqczu (I can haz more to say about my awesome link on Twiter now – YAY)

Download: googl-shortlinks

== Installation ==

1. Upload the entire `goo.gl-shortlinks` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. Navigate to the `Settings > Goo.gl Shortlinks` menu
4. Add your API key for a higher usage limits ‘Homepage Teasers’

== Frequently Asked Questions ==

= What is goo.gl? =

goo.gl is a service that takes long URLs and squeezes them into fewer characters to make a link easier to share, tweet, or email to friends. For example, the short URL http://goo.gl/O2jpy is a convenient shorthand representation for the long URL http://christophercochran.me/.

Goo.gl short URLs are randomly generated, and the mappings of short URLs to long URLs are publicly accessible. Additionally, the short URL to long URL mappings are:

Immutable – once created by you, no one else can change them
Irrevocable – once created, they do not expire. Note, however, that Google reserves the right to remove any goo.gl short URL, for example for spam, security or legal reasons

= Why use the Google URL Shortener? =

People share a lot of links online. This is particularly true as microblogging services such as Twitter and Google Buzz have grown in popularity. With character limits in tweets, status updates, and other modes of short form publishing, a shorter URL leaves more room to say what’s on your mind.

Google’s global production infrastructure to provide users with the following benefits:

Stability – reliable service with good uptime
Security – warning message if the short URL points to a suspected malware, phishing, or spam website
Speed – fast resolution of short URLs (in a few milliseconds)

= Why and where should I get an API Key? =

Why you should get a key

Higher usage limits. Without an API key, we don’t know who you are, and we’re pretty shy. You’ll be subject to anonymous usage limits, and those are very, very low. Your requests will fail when you exceed your limits. With an API key, you’ll have very high usage limits — high enough to accommodate most applications’ needs.
Traffic reports. With an API key, you also get access to fun graphs of your API usage on the APIs Console.

How to get a key

Visit the Google APIs Console and:

Create a project. You can create as many or as few projects as you need. (See the Google APIs Console FAQ for details.) We will generate exactly one key per project.
Activate the URL Shortener API. After creating a project, you should see a list of APIs, each with an Activate button. Click on ours.
Nab the key. Click “Keys” on the left-hand side to find out about yours. The “Value” is the string you want.

= I don’t see the “get shortlink” button in my post page? =

Shortlinks will only be generated on a post save. Don’t want to exceed our limit now do we?

== Screenshots ==

1. Get shortlink popup


2. Authentication


3. History: Display up to the 10 most recent links.

= 1.0 =
* Initial Release
= 1.1 =
* Authentication. This will allow any shortlinks created in this app to be available on the user’s dashboard at goo.gl.
* History: Display up to the 10 most recent shortened URLss.
= 1.1.1 =
* Added uninstall option (removes options when plugin is deactivated and deleted).
= 1.1.2 =
* Fixed an issue when having no API Key entered may call generation of a shortlink to fail even when google API wasn’t exhausted.
== Coming Soon ==

= 1.2 =
* In post link statistics with referrers, clicks, and browser stats.
* Shortcode to place short links inside a post for users to copy.

Download: googl-shortlinks

Comments

  1. says

    im using my api key w/ my google acct that already has a goo.gl acct as well. my shortened links are not appearing under my goo.gl stats, how do i view stats that are generated through your shortlinks app on wordpress?

    • chrisryan says

      This will actually be in the next update. For the short URLs to be linked to your account you also need to authorize the app to allow access. I will be adding Open ID and OAuth options to the plugin to take care of this.

  2. Francesco says

    Great plugi-in, very useful, thanks.

    I was wondering… any reason why the home page gets the latest post’s short link and not its own?

  3. Fabio Sarmento says

    Hello,
    I just want to know if this Plugin has the feature to place the shortened Link in the post or Template like a tag or call the method, such:

    googl_function_blabla( $postID );

    thanks in advance.

    • chrisryan says

      Place < ?php echo wp_get_shortlink() ?> in your template file you wish the shortlink to be displayed ( inside the loop ). Shortcode support will be coming in the next release, I just have to get some time to polish it up a bit before I release.

  4. Jason says

    Great plugin!

    I’m wondering if it’s possible to add “Google UTM” tags to the (long) url, since google analytics sees Goo.gl links 99& of the time as direct traffic.

    Where to add these parameters in the source code of the plugin?

  5. says

    Recently updated in 3.1.1, i added authentification. But i can’t see the button in admin page even after i made a post. The function wp_get_shortlink() also just give me the reel URL too. Do you have an idea ? Thank you

    • chrisryan says

      There was a bug when no API Key was added that had the similar effect. I Just pushed up an update to fix this. Let me know if this fixes your issue as well.

Leave a Reply