Mass customization of URLs/QR Codes
August 28, 2012 10:54 AM   Subscribe

I want to have a large number of unique URLs, all pointing to the same content. Like a million of 'em, so we can track individual recipients' behaviors online; one URL (or set of related URLs) per recipient (say we're sending them an email or a postcard with a QR code).

How to do it? How do we automate the generation of these URLs? And corollary, how to automate the QR code generation? I feel like printing a bunch of unique QR codes is trivial on digital press, but not completely sure how to execute the rest of it.

ALSO: If there's another way—short of giving hardware (flash drive or whatever) to recipients—of accomplishing this aim I'm all ears.

Thanks!
posted by Mister_A to Computers & Internet (3 answers total)
 
The fastest way is to go through a service. A direct-mail service will be able to provide PURLs (personalized URLs) for you on each piece they print, and of course direct e-mail marketing companies do this in opt-in e-mails, as well.
posted by xingcat at 10:58 AM on August 28, 2012 [1 favorite]


This seems like it's more a systems integration issue than a programming issue: What do you want the URLs to tie to on your end and in your database? What does your image processing pipeline look like into your digital press system so that you can generate those QR codes in a way that's easy to print and tie to whatever other information you want on your cards.

As xingcat points out, someone has probably already done this. But if you wanted to do this yourself:

A million QR codes isn't a big deal. 4 characters of a-z, 0-9 gives you nearly 1.7 million combinations, add mixed case and 4 characters gives you nearly 15 million. You'll want a fairly sparse list so people aren't just guessing other people's codes (assuming there's some sort of personalized benefit).

My URL shortener uses an Apache mod_rewrite rule that looks like:

RewriteRule htdocs/(..*)$ http://www.example.com/cgi-bin/tinylink.pl?r=$1

That is: Anything that comes into http://example.com/Sa51xZ gets passed to http://www.example.com/cgi-bin/tinylink.pl?r=Sa51xZ, which can then figure out what to do with it. In your case, that's log that the request happened, and redirect to your marketing materials (possibly with some personalization).

In my case I randomly generate a 6 mixed-case alphanumeric character string, make sure it's not already in the database, and hand out that.

There are tons of QR code generators out there in open source land, seems like this is dictated by your development environment and output environment.

Finally, unless you give people a reason to use a QR code, my guess is that most people will just type in the URL. And unless you give people a reason to use a specific code ("See if your code is a winner!"), they'll just type in the base server name for the URL.

In short: There's nothing technically difficult here, implementation is all a matter of the rest of your environment.
posted by straw at 11:10 AM on August 28, 2012 [1 favorite]


Another way to do this might be to use one URL with a some very simple programming.

In PHP, for example, you can pass variable into a page via a question mark. So a specific user might access www.yourwebsite.com/index?user=42

Where the number 42 will be logged as a user with whatever information you want to track. You can carry that number from page to page.

Although what straw says above is true:
Finally, unless you give people a reason to use a QR code, my guess is that most people will just type in the URL. And unless you give people a reason to use a specific code ("See if your code is a winner!"), they'll just type in the base server name for the URL.

OR rather than give the user code in the link, you could assume that all visitors are unique visitors and assign them an ID upon visiting.

One more option would be to use a website like bit.ly to compress the same URL in a million different ways, though I'm not sure if that will allow you to track the way you would like.

Web developers do both of these things regularly.
posted by jander03 at 5:38 PM on August 28, 2012


« Older How to use up a freezer filled with bananas   |   Uses for an iPad in a house full of tech? Newer »
This thread is closed to new comments.