/*
* VeryFunnyAds.com Omniture Implementation
* Populates data for page view tracking
* Provides functions for user actions
*/
//prepares the URL to be parsed
var pathname = window.location.pathname.substring(1);
//if (pathname.charAt(pathname.length - 1) == "/") pathname += "index.html";
var path_array = pathname.split('/');
var host = window.location.host;
//alert ("pathname: " + pathname + "; host: " + host + "; path[0]: " + path_array[0] + "; path[1]: " + path_array[1] )
//Initializing the JSON that holds the necessary data to be sent to Omniture
var metrics;
initMetrics();
function initMetrics () {
metrics = {
pageName:	"OTHER",
server: '',
channel:	"VeryFunnyAds",
prop1:	'',
prop2:	'',
prop3:	'',
prop4:	'',
prop5:	'',
prop6:	'',
prop7:	'',
prop8:	'',
prop9:	'',
prop10:	'',
prop11:	'',
prop12:	'',
prop13:	'',
prop14:	'',
prop15:	'',
prop16:	'',
prop17:	'',
prop18:	'',
prop19:	'',
prop20:	''
}
}
/* Views to collections, with each item in the top nav dropdowns constituting a "collection" and all pages within the collection contributing to its total (similar to current Custom Insight 2) */
/* tracks as page view */
function trackCategoryViews(category, subcategory) {
initMetrics();
metrics.pageName = "";
metrics.channel = category;
metrics.server = subcategory;
populatePvMetricsData();
s.t();
}
/* tracks video events like Embed, Link, SendToFriend */
/* INCOMPLETE: Not needed in phase 1
function trackVideoRelatedEvents(videoName, videoId, event) {
initMetrics();
metrics.channel = category;
metrics.server = subcategory;
populateEventMetricsData();
s.trackLink();
}
*/
/* Static pages (About, RSS, etc., which are in the bottom nav)
* Detects the path and parameters, and populates variables accordingly.
*/
if (path_array[0] == "veryfunnyads") {
switch(path_array[1]){
case 'index':
case 'index.jsp':
metrics.pageName = "";
metrics.channel = "Home";
break;
case 'about.jsp':
metrics.pageName = "About";
metrics.channel = "Footer Links";
break;
case 'rss.jsp':
metrics.pageName = "RSS";
metrics.channel = "Footer Links";
break;
case 'suggestanad.jsp':
metrics.pageName = "Suggest An Ad";
metrics.channel = "Footer Links";
break;
/*
case '':
metrics.pageName = "";
metrics.channel = "";
break;
case '':
metrics.pageName = "";
metrics.channel = "";
break;
case '':
metrics.pageName = "";
metrics.channel = "";
break;
case '':
metrics.pageName = "";
metrics.channel = "";
break;
*/
}
}
/* Search terms (currently captured in Custom Insight 2) */
/* Video views per video (you may want to look at the current Custom Insight 5-it may now be irrelevant. We used it to reconcile Omniture video views with those reported by the CMA.) */
/* The site basics like uniques, visits, referrers, etc.*/
/* Note: The new site doesnÕt allow the user to select a specific Brand or Country, unless they do so from the metadata below the video player. Instead, they have to choose an alphabetical grouping. So thatÕs what weÕd report on. */
/* Clicks to the blog from the index page */
/* Helper Functions */
/* generic track metrics */
function populatePvMetricsData() {
if (metrics.pageName == 'OTHER') {
s.pageName = metrics.channel + ":OTHER:" + window.location.href;
} else {
s.pageName = metrics.channel;
if (metrics.server != '') {
s.pageName += ":" + metrics.server;
}
if (metrics.pageName != '') {
s.pageName += ":" + metrics.pageName; // [Category (ex. Fans, Stars)]:[SubCategory (ex. Most Recent, Friends)]
}
}
s.server = metrics.channel + ":" + metrics.server; //"Country:" + [Category (ex. A-J)]; // subsection
s.channel = metrics.channel; //"Country"; // section
s.prop1 = window.location.href;
s.prop19 = metrics.prop19; // search term
s.prop20 = metrics.prop20; // search type
s.eVar2 = s.channel; // section
s.eVar3 = s.pageName; //s.pageName
s.eVar19 = metrics.eVar19; // search term
s.eVar20 = metrics.eVar20; // search type
}
/* generic track metrics */
function populateEventMetricsData() {
if (metrics.pageName == 'OTHER') {
s.pageName = metrics.channel + ":OTHER:" + window.location.href;
} else {
s.pageName = metrics.channel + ":" + metrics.server + ":" + metrics.pageName; //"TCM Fan Community:" + [Category (ex. Fans, Stars)]:[SubCategory (ex. Most Recent, Friends)]
}
s.server = metrics.channel + ":" + metrics.server; //"Country:" + [Category (ex. A-J)]; // subsection
s.channel = metrics.channel; //"Country"; // section
s.prop1 = window.location.href;
s.prop19 = metrics.prop19; // search term
s.prop20 = metrics.prop20; // search type
s.eVar2 = s.channel; // section
s.eVar3 = s.pageName; //s.pageName
s.eVar19 = metrics.eVar19; // search term
s.eVar20 = metrics.eVar20; // search type
}

