OpenX Blog

Targeting banners using site variable targeting

by Arlen Coupland on October 17th, 2008

I can’t resist… the impulse is too strong… I click on banners which advertise movies featuring caped crusaders and fast cars. I know this because it’s in my nature, but how do you, the publisher, decide that you should show me ads about action movies rather than financial services?

You could try channelling the essence of Arlen but it’s not easy. Firstly you’ll have to buy a slick fannie pack. Then get some sweet Canadian rock tunes playing repeatedly in your head. And third… well actually that’s pretty much it, I don’t lead a complicated life.

But if you are without Canadian rock or fannie packs have no fear, banner targeting is here!

Luckily for you I am a registered member of your website and have provided you with a steady stream of useful information: age, gender, location, interests, address, marital status, # of children, favorite brand of maple syrup, and the like.

We have covered in other areas of documentation and tutorials different methods of targeting banners. Right now I’d like to go over the site variable method which is new in version 2.6. It is very similar to the source targeting option however it is much more versatile as you are able to define your own variable names and use as many as you like.

As the source targeting guide is very well written by community consultant Erik Geurts, I would highly suggest reading it first. The difference here is that on the delivery limitations page of a banner you will want to use the site->variable option rather than site->source.

Once you have chosen this option, you will want to provide a variable name and a value for this variable. Let’s use ‘gender’ as the variable name and ‘male’ as the value, and leave the equation option as ‘is equal to’.

Now the banner (or channel) which you assigned this limitation to will only display when the invocation tag tells OpenX that the ‘gender’ variable equals ‘male’. After you have placed an invocation tag on your website you will need to add some coding which adds a name of a variable to the tag and the value of said variable. This will require some coding knowledge and will change depending on how your site is built. I will give an example using basic PHP using a JavaScript invocation tag from OpenX.

I won’t post the whole JavaScript tag, but in the middle you will see lines similar to:
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=5");
document.write ('&amp;cb=' + m3_r);

What you want is a line after the zoneid which adds a variable and value, like:
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=5");
document.write (’&amp;gender=<?php echo $user['gender']; ?>’);
document.write (’&amp;cb=’ + m3_r);

What this will look like when rendered by the website would be ‘ajs.php?zoneid=5&gender=male’. The actual code will of course change depending on your website and how you store user data.

This is just the tip of the melting iceberg, but hopefully it helps many of you get started with this new feature. We will be adding an advanced tutorial which shows in more depth how to use the feature and how to append variables and values to different invocation tags. Basically - you want to add the variable after the main delivery file name. So for iframe it would be ‘afr.php?zoneid=5&amp;gender=male’. Single page call would have ’spcjs.php?id=1&amp;gender=male’.

So now that you know the user is male, you can focus on banners with subjects males most likely are interested in (like football and football - by the way geotargeting is also useful). Sure I once clicked on a banner for High School the Musical but that is an exception, not the rule (but it does exceptionally rule!).

As an example of how far this targeting can go, let’s say you add ‘favoriteFood’, ‘favoriteBand’, and ‘favoriteActionHero’ to the invocation tag - when I view a page, I might see a banner something like this. Definite click!

It’d be great if you can provide examples of how to code such basic additions to the invocation tag using your favorite programming language, CMS or templating system. Five stars and a smiley emoticon go to whomever points out a way to automatically grab page meta keywords, page title, and other such keywords and auto-add them to an invocation tag for a method of content-relative targeting.

20 Comments »

  1. we’re using it to enable site-brandings that come along with a set of ads. when our cms detects the user is surfing in a section of the website that should be branded, it adds the needed css and a branding={brandingid} to the openx invocation. in openx, we only have to check if the variable is set with the expected value for an ad.

    it gives us the flexibility to use multiple brandings at once (i.e. one for movies, one for games) or have just portions of the site branded (i.e. trailer-sections).

    Comment by thomas — October 19, 2008 @ 10:57 pm

  2. Yes, its good to make sure to mention that it doesn’t have to be used for user data, such a feature is probably more often used for site/page/content targeting

    Cheers,
    Arlen Coupland
    OpenX

    Comment by Arlen Coupland — October 19, 2008 @ 11:11 pm

  3. Would be good to have site variable functionality available in local mode invocation.
    Cheers,
    Terry, Newcastle

    Comment by Terry — January 8, 2009 @ 4:10 pm

  4. Very nice tutorial, i used it for a while, but now I am switching to single page call instaed of javascript tag, and there is my question:
    How to make it work in single page call?

    Comment by klon — January 26, 2009 @ 1:40 pm

  5. Hi,

    As Terry said, It’d be great to have this functionality available in local mode invocation.

    I tried, as someone said (don’t have the post anymore), to add the parameters to the $_REQUEST array but it doesn’t work.

    Does anyone know if it’s possible to do that to local mode invocation?

    Thanks in advance,

    Filipe

    Comment by Filipe Knoedt — February 17, 2009 @ 6:13 pm

  6. I tried to use $_REQUEST , it works for me.

    For the above example, add the following line in the invocation code

    $_REQUEST['gender']=’male’;

    Comment by Venkatraman — February 26, 2009 @ 1:23 pm

  7. how I create a x blog block can you please guide me

    ali.bahi44@gmail.com

    Comment by ali raza — June 1, 2009 @ 4:11 am

  8. [...] be able to target with source parameters, the Site - Source delivery limitation type requires that changes to the zone tags will need to be made so that the appropriate source parameters are passed into the OpenX ad server calls and allow the [...]

    Pingback by Tip #15: Site segmentation and zone hierarchies « OpenX Tips — June 8, 2009 @ 12:07 pm

  9. The underlying idea of this post is brilliant in that the proposed solution would improve ad-targeting and eventually make advertising more welcome and useful to users (audience). I regularly implement Drupal CMS with OpenX and here is what would be my approach to targeting ads based on keywords derived from content taxonomy and other metadata that is particular to user profile information, displayed content or a combination of the two:

    Taxonomy:
    The Drupal CMS framework uses vocabularies to categorize terms and the terms for a given content item (node) can be pulled using:
    taxonomy_node_get_terms_by_vocabulary($node->nid, 6) will output the terms for the current node within the vocabulary with vid=6 . This approach makes it possible determine a vocabulary (topic, industry vertical etc) and pull the tagged term for the current page. This variable can then be fed into OpenX and used to target matching ads to a specific page or content category.

    User Profile
    Similar to the above, content stored in the user-profile can be pulled and used along with content-specific values to finely target the ads. For instance, we can choose to target a given add to all account-holders who are CIOs in the banking industry viewing site content that has to do with the Auto industry.

    The above implementation plan will improve ad-targeting to a point where it will be highly relevant to your audience and actually be supplemental content as opposed to just being advertising with the sole purpose of collecting clicks

    Comment by Donny Nyamweya — June 26, 2009 @ 9:28 pm

  10. I’m new to Openx and this is a very helpful article. However, I’m still a bit confused about how site variable targeting works when there are multiple combinations of possible values. For example, my site collects information such as age, gender, occupation, city, and so on.

    I can easily figure out how to pass these values to Openx, but does that mean I need to create a channel, or banner for every possible combination of values? In other words, create a banner that only displays for male students in Toronto and another banner that only displays for male lawyers in Toronto?

    Perhaps I’m missing something obvious… like I said, I’m new to Openx so please have patience with me!

    My Openx server is configured to serve Google AdSense ads, and I’m hoping to find a better way of targeting site visitors. Thanks in advance for any help, or suggestions.

    Comment by jordan — July 16, 2009 @ 3:43 pm

  11. wwwwww

    Comment by ww — July 16, 2009 @ 8:44 pm

  12. just drop by. very useful.

    Comment by Kate — July 22, 2009 @ 2:36 am

  13. Hi Terry,

    I’ve followed your tutorial and it’s not working for me. If you have a moment can you visit:
    http://forum.openx.org/index.php?showtopic=503428695&hl

    Thanks,
    Chas

    Comment by Chas — July 25, 2009 @ 8:28 pm

  14. With some modifications, is working for us in local mode (php) using a syntax like:

    $_what = “zone:{$_zoneid},state={$_state},city={$_city},guide={$_guide}”;

    of course, the embedded variables are parameters I’m passing to our wrapper function, then it just calls the regular OpenX code:

    if (@include_once(MAX_PATH . ‘/www/delivery/alocal.php’)) { ….

    Best regards, Sandro.

    Comment by Sandro Franchi — September 25, 2009 @ 10:00 pm

  15. hi sandro, not sure about:
    $_what = “zone:{$_zoneid},state={$_state},city={$_city},guide={$_guide}”;
    how do you use it? I’m having an hard time figuring why sometimes $_REQUEST variables are lost.

    any example is welcome.

    regards

    Comment by sathio — October 1, 2009 @ 3:37 pm

  16. fadkqvmxwbcjn tennis…

    fadkqvmxwbcjn senators geologists tigers guillemots islands trucks cobblers infantry money bacteria martens stairs servants tests matrons snipe gods documents referees keyboards sea knights employees submarines ladies fairies gypsies arrows canal…

    Trackback by fadkqvmxwbcjn tennis — October 7, 2009 @ 9:09 am

  17. I like your post. No matter what amount of debt a person has, willingness to retire is the first step

    Comment by Michelle Boudreau — October 12, 2009 @ 7:41 pm

  18. Can I have a Single Page Call version with Example?

    Comment by Adnan Siddiqi — October 14, 2009 @ 4:56 am

  19. It’s really amazing. Debt can be rescued by reducing expenses not by increase income

    Comment by Debt Rescue Relief — October 14, 2009 @ 5:20 am

  20. Ok, thanks for the post, but I think this should really be in the help section… Also, ability to insert variables should be included in admin panel… yes, I know, they’re dynamic thing, but with such option you would at least know how to insert them… Also, as the “variable” is real http parameter (”variable”) you must use caution to not overwrite OpenX variables e.g. “zoneid” - best option is to use some kind of prefix for “variables” e.g. “v_” - “v_myvariable”

    Comment by X — November 6, 2009 @ 12:32 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment