#1711 - Country Specific Banners

This is a spacer post for a website comment topic. The content this topic relates to: #1711 - Country Specific Banners
You could simulate this in Tempcode.

Untested code...

{$BANNER,{$?,{$AND,{$EQ,{$GEOLOCATE},US,GB},{$GT,{$RAND},16000}},banner_{$GEOLOCATE},banner_regular}}

Code says...
If geolocates to either US or UK and 50% of the time (*), then show a banner of type banner_<countrycode>, otherwise show a banner of type banner_regular.

* A random number between 0 and 32000 is over 16000.
Okay, that's handy to know. Do I create a different class of banner for each region such as banner_uk? I understand the tempcode to a degree, but not sure how it will know which banner is which. I will have a play around and see what I can do with it, but what is simple in your mind is kinda muddled in mine :P

Anyway, this is not something I personally need as I said, but I thought as some people will be using Composr for multilingual sites, that this would tie in nicely with the internationalization aspects of Composr.
So create these banner types banner_regular, banner_GB, banner_US.

$GEOLOCATE returns 'GB', 'US', etc - the ISO country codes. I built that into the banner type names outputted by my Tempcode above.
Okay so my thinking was right. Still getting to grips with Tempcode but it certainly seems versatile. Thanks for the clarification.
I'm going to drop this because I prefer the flexible Tempcode approach. If we start making display options for banners then it's a never-ending story -- countries may just be one of 30 variables being targeted (language, state, usergroup, past behaviours, demographics...).
0 guests and 0 members have recently viewed this.