/* This file contains standard metrics helper functions. DO NOT ADD FUNCTIONS TO SUPPORT A PARTICULAR PROJECT WITHOUT CHECKING WITH THE APPLICATION TEAM */ function OInternalMetrics(){ /* This class does access metrics variables that are outside the class scope (ugh) * but, the methods are encapsulated and can't be accessed by accident */ /* Public Method Pointers */ this.m_clear_tempvalues = m_clear_tempvalues; this.m_set_FVSection =m_set_FVSection; this.m_set_s_PageName = m_set_s_PageName; this.m_set_s_Hierarchy = m_set_s_Hierarchy; this.m_set_s_Channel = m_set_s_Channel; this.m_set_s_events = m_set_s_events; this.m_set_OnClick = m_set_OnClick; this.m_set_VideoStart = m_set_VideoStart; this.m_set_VideoComplete = m_set_VideoComplete; this.m_clear_nameplate = m_clear_nameplate; this.m_set_nameplate = m_set_nameplate; this.m_set_v48and49 = m_set_v48and49; /* Standard function to clear out values that only get recorded once */ function m_clear_tempvalues() { s_events=""; s_products=""; s_prop5=""; s_prop6=""; s_prop7=""; s_prop48=""; s_prop49=""; s_eVar48=""; s_eVar49=""; } /* IVISection helper functions */ function m_set_FVSection(sS) { if (sS.length > 0) FVSection=m_cleanData(sS); } /* Set Pagename: sets the value for the pagename variable Default behaviour is append the value passed in to the BasePageName bO: Override. Sets sS to the full value passed in */ function m_set_s_PageName (sPN, bO) { var sTemp //only change the pagename if len > 0 if (sPN.length > 0) { if (bO == 1) sTemp= (s_siteID + ":" + sPN) else sTemp = (s_siteID + BasePageName + ":" + sPN) } s_pageName=m_cleanData(sTemp); } /* Set sHierarchy: sets the value of the js variable */ function m_set_s_Hierarchy(sH){ var sTemp; if (sH.length > 0) sTemp=(s_siteID + sH); else sTemp=s_siteID; //s_hier1=m_cleanData(sTemp); s_hier1=sTemp; } /* Set sChannel: sets the value of the js variable Note: Is this a ":" delimited list as well? so far only single values used. */ function m_set_s_Channel (sC) { s_channel=m_cleanData(sC); } /* set events: sets the success events variables It is up to the calling function to clear out any old events This function appends only. */ function m_set_s_events(sE, seVar28) { if (s_events.length > 0){ s_events = (s_events + ";") } s_events = m_cleanData(s_events + sE); if (typeof(seVar28)!="undefined"){ s_eVar28 = m_cleanData(seVar28); } } /* Standard function to set the value for an on-click event. Used for "doing things" on a previously set pagename */ function m_set_OnClick(sA) { s_prop5=m_cleanData(sA) } /* Standard function to set the value for a Video Start OnCLick event. Used for "doing things" on a previously set pagename */ function m_set_VideoStart(sA) { s_prop6=m_cleanData(sA) } /* Standard function to set the value for a Video Complete OnCLick event. Used for "doing things" on a previously set pagename */ function m_set_VideoComplete(sA) { s_prop7=m_cleanData(sA) } /* New function to set the value v48 and v49 Used for "adding variables" with the set pagename */ function m_set_v48and49(s48, s49) { s_prop48=m_cleanData(s48); s_prop49=m_cleanData(s49); s_eVar48=m_cleanData(s48); s_eVar49=m_cleanData(s49); } /* NOT USED YET */ function m_clear_nameplate() { s_nameplate=""; s_modelyear=""; } /* NOT USED YET */ /* Set nameplate: This function should only be used when nameplate data needs to be set dynamically. Otherwise, value in parser is preferred. */ function m_set_nameplate (sNameplate, sModelYear) { s_nameplate=m_cleanData(sNameplate); s_modelyear=m_cleanData(sModelYear); } /* TRUELY PRIVATE METHODS */ function m_cleanData(sString) { //cleanse the data for Omniture sString=(((sString.toLowerCase()).replace(/'/g,"")).replace(/ /g,"_")); sString=escape(sString); sString=unescape(sString); return sString } } /* *********** END CLASS *********** */ /*Misc functions that were added for some project */ function promoMetricsForExternalSite(sLink, sPageName){ mVirtualPage(sPageName, '', ''); popInternal(sLink); } function popInternal(sURL) { // function to open without popup message n = window.open(sURL, 'n', 'width=750,height=555,location=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'); n.focus(); } /* Standard omniture functions for sending metrics. Moved from in-line */ function sendAnalyticsEvent(str){ ns=s_account; if(str!=null)ns+=","+str;void(s_gs(ns)); } function sendLinkEvent(str,lnkname){ ns=s_account; if(str!=null)ns+=","+str; s_linkType="o";s_linkName=lnkname;void(s_gs(ns)); } /* Standard function for section load in IVI */ function mFVSectionLoad(sSection, sChannel, sHierarchy, sSubsectionStr) { var oMetrics = new OInternalMetrics() oMetrics.m_clear_tempvalues() //re-set section if necessary if (sSection.length > 0) oMetrics.m_set_FVSection (sSection); //append susection if required if (sSubsectionStr!=undefined && sSubsectionStr.length > 0) oMetrics.m_set_s_PageName (FVSection + ":" + sSubsectionStr, 0); else oMetrics.m_set_s_PageName (FVSection, 0); //Don't set channel anymore. Should change the interface at some point. //if (sChannel.length > 0) m_set_s_Channel (sChannel); //append new value to base value if (sHierarchy.length > 0) oMetrics.m_set_s_Hierarchy(BaseHierarchy + ":" + sHierarchy); sendAnalyticsEvent(''); } function mFVContentActivity(sActivity) { //wrapper function for the core flash app, in case it needs to do something different than modules mContentActivity (sActivity); } /* Standard function to append further information to the BasePageName value and trigger a metricsevent. Used for flash/dhtml events nType=1 : Send link event, not Analytics bOverride=1 : do not append, just overwrite the pagename */ function mVirtualPage (sPageName, sChannel, sHierarchy) { var oMetrics = new OInternalMetrics() oMetrics.m_set_s_PageName (sPageName, 1); oMetrics.m_set_s_Channel (sChannel); oMetrics.m_set_s_Hierarchy(":" + sHierarchy); oMetrics.m_clear_tempvalues(); sendAnalyticsEvent(''); } //Used for most flash/dhtml page views (non-specialized) function mContentView (sPageName, bOverride) { var oMetrics = new OInternalMetrics() // sets the page name and triggers send metrics events oMetrics.m_set_s_PageName (sPageName, bOverride); oMetrics.m_clear_tempvalues(); sendAnalyticsEvent(''); } //Used for most flash/dhtml page views, set Page Name and v48 and v49 function mContentViewAnd48_49 (sPageName, s48, s49) { var oMetrics = new OInternalMetrics() // sets the page name and triggers send metrics events oMetrics.m_set_s_PageName (sPageName); oMetrics.m_clear_tempvalues(); oMetrics.m_set_v48and49(s48, s49) sendAnalyticsEvent(''); } //Another call for mContentView (vendor screwup) function sendMetrics (sPageName, bOverride) { var oMetrics = new OInternalMetrics() // sets the page name and triggers send metrics events oMetrics.m_set_s_PageName (sPageName, bOverride); oMetrics.m_clear_tempvalues(); sendAnalyticsEvent(''); } function mContentActivity (sActivity) { //just triggers an "onClick" for something on an existing page. var oMetrics = new OInternalMetrics() oMetrics.m_clear_tempvalues(); oMetrics.m_set_OnClick(sActivity); sendLinkEvent(''); } /* this is a test for the sendLinkEvent implementation .cmp */ function mContentActivityNew (sActivity) { //just triggers an "onClick" for something on an existing page. var oMetrics = new OInternalMetrics() oMetrics.m_clear_tempvalues(); oMetrics.m_set_OnClick(sActivity); sendLinkEventNew('',sActivity); } function mVideoActivity (sVideoName,bComplete) { var oMetrics = new OInternalMetrics() oMetrics.m_clear_tempvalues(); if (bComplete==0){ oMetrics.m_set_VideoStart(sVideoName); } else { oMetrics.m_set_VideoComplete(sVideoName); } sendLinkEvent(''); } function mDownloadBrochure(sPageName, bOverride) { var oMetrics = new OInternalMetrics() oMetrics.m_set_s_PageName (sPageName, bOverride); oMetrics.m_clear_tempvalues(); mEventAndFloodLightMetrics() // oMetrics.m_set_s_events("event15"); sendAnalyticsEvent(''); oMetrics.m_clear_tempvalues(); } /*The following functions are being depricated to support ongoing metrics tweaking. Do not re-use */ function MEFlash(var1){ //deprecated. redirect to mContentView mContentView(var1); } function ME( sec, pe, ped, trm, clr, fvevent) { // Measure Me Event .... will ve invoked when the page will be loaded/from flash to send data to Omniture //deprecated. } var js_sCat = "vhp" var js_sNamePlate = "ford taurus" var sMetricEvent_Delayed = "event" var sMetricEvent_DelayedEVar28 = "" var sDelayEvent = "" var sDelayFloodLight = "" function OFloodLight(){ this.createFloodLight = createFloodLight; this.fireFloodlight = fireFloodlight; //this was used in order to dynamically fire during the viewing of a page(video start/stop) function fireFloodlight(sCat, sNamePlate){ var strsrc = 'https://fls.doubleclick.net/activityi;src=690327;type=fvflup;cat=' + sCat + ';u1=' + sNamePlate + ';u6=0;ord=?' var objIFrame = document.getElementById("IfrmFlood"); if(objIFrame){ objIFrame.src = strsrc; } } function createFloodLight(sCat, sNamePlate, delayedFloodlight){ var axel = Math.random()+""; var a = axel * 10000000000000; //added delayedFloodlight in order to capture a floodlight call onClick if (delayedFloodlight || window.navigator.userAgent.search(/Firefox/) > 0){ // Code exception for firefox var node = document.createElement("div") node.innerHTML = '' document.body.appendChild(node) }else { document.write(''); } } } oFloodLight = new OFloodLight() function mEventMetrics( ){ var oMetrics = new OInternalMetrics() oMetrics.m_set_s_events(sMetricEvent_Delayed, sMetricEvent_DelayedEVar28) } function mFloodLightMetrics(sCat, sNamePlate){ if (sDelayFloodLight != "true"){ oFloodLight.createFloodLight(sCat, sNamePlate) } } // Only use for delayed Event and delayed Floodlight function mEventAndFloodLightMetrics(){ var oMetrics = new OInternalMetrics() oMetrics.m_set_s_events(sMetricEvent_Delayed, sMetricEvent_DelayedEVar28) //oFloodLight.createFloodLight(js_sCat, js_sNamePlate) //added argument for delay (onclick) oFloodLight.createFloodLight(js_sCat, js_sNamePlate, true) } /* NEW EVENT CALL */ function sendLinkEventNew(str,lnkname){ ns=s_account; if(str!="" || str!=null)ns+=","+str; s_linkType="o"; s_lnk=true; s_linkName=lnkname; void(s_gs(ns)); }