DirtyNative
DirtyNative

Reputation: 2854

Google URL Shortener calls shortened URL by creation

I am trying to shorten a really long URL with the Google API. This URL contains some information about a User of a program, and if clicked, there happens some magic on the server, and the magic should only happen if the user itself has clicked the Link.

Now if I shorten a Link with the Google-URL-Shortener, Google automatically calls that Link which lets the server do some action. I think this is a validaton check or something.

Is there a way to deactivate that or do I need to use an other provider?

Thanks for your help

Upvotes: 1

Views: 269

Answers (1)

Umair Ansari
Umair Ansari

Reputation: 173

From what I've read google and other url shorteners will visit the url to create a preview. I had the same issue when trying to shorten an unsubscribe url and decided to add a confirmation step so that the subscription wouldn't be unsubscribed when shortening the url.

Another solution is to key off the User Agent field and prevent the default action if the User Agent is a url shortening bot.

Since I don't control the User Agent field I was concerned the url shortener service might change the User Agent value in the future and hose everything so I decided not to do it this way.

Upvotes: 0

Related Questions