OpenX: Allowing banner links to use the host of the page the banner is being displayed on
My client has a website with many subdomains, each representing a different "client":
http://www.store.com <- Main store; also the default OpenX "Website" host in admin.
http://client1.store.com <- Client store http://client2.store.com <- Client store ... http://client222.store.com <- Client storeA开发者_运维知识库 lot of the banners are internal links. For those internal ads, they use relative URLs in that banner's "Destination URL" field, in hopes that the link will use the host of the page the ad is being displayed on. But to no avail, the ads seem to always use the host of the OpenX "Website" that that zone is connected to.
So for these local ads I need the host of the destination URLs to match the page the ads is being displayed on. Any suggestions?
The answer to this question was to set the Banner's URL to something like this:
http://{currenthost}/shoes-half-off
Then pass extra, custom variable currenthost
into the invocation code.
If the zone is in Local Mode
Set the variable like this, somewhere before your call to view_local()
:
$_REQUEST['currenthost'] = $_SERVER['HTTP_HOST'];
$raw = view_local($what, $zoneid, $campaignid, // ...
If the zone is in Javascript Mode
Pass it into openx/www/delivery/ajs.php
as a part of the GET string. Turn this:
// ...
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("'><\/scr"+"ipt>");
// ...
Into this:
// ...
if (document.mmm_fo) document.write ("&mmm_fo=1");
document.write ("&currenthost="+window.location.href); // <-- Added
document.write ("'><\/scr"+"ipt>");
// ...
精彩评论