Search code examples
short-urlgoo.gl

generate multiple unique short urls?


Is there a way with goo.gl or a similar service to generate multiple unique short urls for a given url?

For example, if I run the following code multiple times

curl https://www.googleapis.com/urlshortener/v1/url \
  -H 'Content-Type: application/json' \
  -d '{"longUrl": "http://www.google.com/"}'

I always get the same short url in return

{
 "kind": "urlshortener#url",
 "id": "http://goo.gl/fbsS",
 "longUrl": "http://www.google.com/"
}

I would like to be able to generate n diferent short urls, and to be able to get the statistics for those individual urls (that all redirect to the same site)

Thanks!


Solution

  • I don't know if there is a service who gives you multiple URL's, because I guess that they hash the URL and save it in a cash, so you always get the same URL. But my idea (if this is accaptable for you) would be to add some random parameters. So take the shortened URL and just add something like "?v=random_string" at the end of your id. This ways your URL is still shorter, but you have etxra parameters...