HTML and CSS Reference
In-Depth Information
var timeLoc = m + '/' + d + '/' + y + '&' + dom;
var se = ad + '-' + placement + '-' + campaign + '-' + publisher + timeLoc;
localStorage.setItem('SiteEvent', se);
}
setiOSiteEvent('advertiser', 'placement', 'campaign' , 'publisher');
</script>
As Listing 8-9 shows, you can make a function called setiOSiteEvent , which gets a few parameters that will
eventually be passed in by the ad server at ad-serve time. These could be the advertiser's name, placement identifier,
campaign identifier, and the publisher where the ad is running. Next, inside our function, declare a few variables— m ,
d , y —they accurately timestamp when the site event occurs. Next, grab a reference to the URL location by writing var
dom = window.location.href; —this will give the exact page location where the viewer saw the ad. Next, call another
var, timeLoc , which stands for time/location and gets a concatenated value of the time values and the location, or the
URL address. Next, create our final var, called se , which gets all of the ad server values, as well as our timestamp and
location values. Finally, call up our localStorage object and assign se to it by storing the value through a setItem call.
This localStorage.setItem call will store all of the site event (se) information to the user's browser so the advertiser's
page can later reference it. Listing 8-10 showcases how this could be performed on the advertiser's page.
Listing 8-10. A localStorage Site Event Example (Advertiser's page)
function getiOSiteEvent () {
if(localStorage == '' || localStorage == null) {
return;
} else {
//Grab iOS Site Event
console.log(localStorage.getItem('SiteEvent'));
var seCall = new Image();
seCall.src = ' http://tracking.adserver.com?siteevent= ' +
localStorage.getItem('SiteEvent');
setTimeout(localStorage.clear(), 500);//Clear the information
once the metric is reported
}
}
getiOSiteEvent ();
When a user visits the advertiser's page, the function getiOSiteEvent will fire. In the function, check whether the
user has any location storage information. If the user doesn't, just back out of the function; if the user does, create a
new Image (much like our third-party tracking example) and set its source attribute to the tracking location. Finally,
once the ad server gets the metric, set a time-out and clear the localStorage in the user's browser so we never track
this value again. There are many ways, other than the dated cookie approach, to do this; generally, the choice will
depend on the ad server you're using and the browser adoption of client-side storage techniques.
Mobile Video Advertising
At the time of writing, the biggest mobile advertising market is video—traditional in-stream or pre-roll video with VAST.
As the last chapter demonstrated, VAST is the IAB's industry-wide specification for delivery of video ads to video players—
and mobile is no different. Mobile video being one of the fastest-growing markets in our industry, advertisers started
looking to use pre-roll ads to get the attention of all the eyeballs in the small screen space. Figure 8-10 (from eMarketer)
estimates worldwide mobile video use going into 2016.
 
Search WWH ::




Custom Search