How LinkedIn's special keyword Google AdSense works
By Osma on Wednesday 21 January 2009, 13:31 - Permalink
Have
you noticed how Google AdWords shows you directly targeted advertising on
LinkedIn? Something that goes far beyond AdWord's normal capabilities of
targeting. For example, I always see recruitment ads for a local Java
consultancy house known for their agile process expertise, no matter what I'm
doing on LinkedIn. It certainly doesn't have anything to do with the page the
ads are on, nor is it related to search keywords. As a proof, take the case of
searching for a farming expert in Nepal: I'm still seeing ads for that
consultancy, Scrum process management tools, and SOA testing. If there's a
connection to my activities, I'm at loss what it is.
However, I know exactly what they ARE targeting. My own profile, which mentions all those things, and more. LinkedIn and Google are not advertising to my stated intent (what I'm searching for), or the page content (as an AdSense customer might expect), but myself and what I've told the service about me.
How does this happen? It certainly isn't anything Google documents to their normal customers. The closest thing I know of is keyword hints, and even that is not publicly documented by Google for anything but parked domain names. This is something different, it's too specific, and google_hints doesn't get you the same results. I took it upon myself to figure this out for good, because I'm at home, in a flu, and bored out of my mind. Plus, I'd like to use this myself if I could figure out how it's done :)
Digging in to the LinkedIn JavaScript, the first thing that comes across is a one-liner that sets a variable named google_keywords. This certainly has to be connected, though to me it only states my industry, Computer Games, which is nowhere near specific enough to target those ads to me. However, something else comes up next: a sourced javascript file in an address beginning with https://www.linkedin.com/ads/google and with an obscure, very long encrypted or hashed string at the end. What's in here? What else but a complete list of all the keywords I've mentioned somewhere in my profile. That's obvious enough -- any service with a user profile could create such a keyword list for each of the profiles. But how does that relate to the ads?
There are no standard AdSense tags anywhere on Google's pages. There are some tags that are fairly run-of-the-mill stuff for DoubleClick, now of course owned by Google also, but those are not serving the AdSense ads I'm seeing, at least, not directly. There is this:
<div class="textad">
<script
type="text/javascript">
var dbl_extra = 'extra=null',
dbl_page = 'people_search_results', dbl_tile = '1', dbl_profile =
LIAds.getProfile().replace(/&/g,';'), dbl_sz = '1x1';
var dbl_src =
"http://ad.doubleclick.net/adj/linkedin.dart/" + dbl_page + ";" +
"optout=false;" + "lang=en;" + dbl_profile + ";tile=" + dbl_tile +
";dcopt=ist;sz=" + dbl_sz + ";" + encodeURIComponent(dbl_extra) + ";ord=" +
dbl_ord +"?";
document.write('<script src="' +
dbl_src + '" type="text/javascript"><\/script>');
</script>
</div>
That LIAds.getProfile() bit of course raises some curiosity, but in fact, it's a red herring. It does fill in a set of variables to the ad request, including my zip code, part of my title, and similar things. Still, nothing that would cause AdSense to show those particular ads to me time after time.
The response for that request is far more interesting, though. Let me show
it:
document.write('');
google_channel_id=5747705451;
google_show_ad();
document.write('');
Now we're getting somewhere! Immediately after processing this response, the browser fires off a request to googlesyndication.com that looks pretty much exactly like one of the standard AdSense requests, with a major, major exception: it has an extra parameter kw listing everything on that google_keywords line that was set at the beginning of the page. What's that google_show_ad(), and where is it defined? Why can't I see LinkedIn loading the JavaScript from http://pagead2.googlesyndication.com/pagead/show_ads.js as pretty much every other AdSense site does, like they instruct in their account setup system?
LinkedIn has optimized most of their JavaScript to just a couple of massive, whitespace-stripped blocks of library after library of code loaded from the CDN. In one of these files, there's a couple of screenfuls of code that is marked as originating from js/ads.js in their source library, and it's here where the LIAds class is also defined. The getProfile() function is there, but it's uninteresting to me. What is interesting is that we can also find a customised version of Google's AdSense client code here. I don't think you're supposed to cache your own copy of this, let alone customize it, so LinkedIn must have a pretty special relationship with Google..
It's this code which loads their AdSense blocks, and inserts the long keyword list to those requests which effectively overrides what Google's indexes think would be the context for that page. It also does a lot of slightly-creepy snooping around on your computer ahead of time, just as AdSense normally does. Did you know, for example, that AdSense knows what your computer screen size is, how many plugins you've installed, and how many pages you've visited in that browser window, and that they can also follow your traverse around the internet between sites that have no other relationship to each other besides you visiting them? That's the life on the internet -- the advertiser knows a lot about you, and Google knows everything. But again, that's not what I'm trying to uncover here, because there's nothing new nor interesting there.
Back to how those ads got targeted, and whether you could do that on your
own AdSense account, too. Lets take that query and run it off manually. Before
that, lets strip off everything that doesn't seem to affect the functionality
out of the address. What's left is this: click on that link, and
you should see medical ads for flu treatment. Click on those, and the money
goes to LinkedIn. Change the list of keywords at the end of the address to
something else, and you'll see ads for that topic.
Unfortunately, this doesn't seem to be generally useful. Though the standard
AdSense library also knows about the kw parameter, I can not find a way to pass
it in. And even if I did, or went through the trouble of writing a special
AdSense library of my own like LinkedIn did, this functionality seems to be
limited to certain advertiser profiles only, just like google_hints (which I
believe to be less powerful) is. Just try to insert your own AdSense publisher
ID into that address above; I bet you'll start getting public service ads or
nothing instead of those targeted text ads. At least, that's what happened with
my AdSense ID. I guess that proves it: LinkedIn does have a pretty special
relationship with Google.
It's kind of understandable; there are few sites who could produce such
usefully targeted personal user profiles as LinkedIn can, and certainly far
fewer than those who'd start playing with this sort of functionality and create
all kinds of havoc if it really was widely available. That said, it's still a
bit annoying that I can't at least try to make ads more relevant to our users
with the same approach. I tried; when I first noticed LinkedIn doing this, I
asked around at Google for more information, but none was forthcoming. If that
was for this blog only, I wouldn't be surprised; but since I was asking on
behalf of the largest social networking
service in Finland, and the largest teen
virtual world in the world, and still got nowhere, it does seem to be
pretty exclusive stuff.
I'd love to hear from anyone who has more dirt on this matter. Leave a comment.
Cheers!
Comments
Really, really interesting! And depressing, since our web site needs exactly this functionality.