/* * Name: * stats_tracker.js * * Description: * * * Pre-conditions: * * Post-conditions: * * Libraries: * - createStatCookie , readStatCookie , eraseStatCookie functions are defined into * docrootx/javascript/global_functions.js * * Log: * Prajapati Nilesh 07 May 2008 * - Creation * */ var d=document; var popOver = true; //to allow pop UP or pop OVER (in div with iframe external file) var podClick = false; var tracker = false; //ajaxArray = new Array(); var sIndex = 0; debugStr = true; //this is used for to show the response into test page from ajax //and for this we need one
into the test page var siteUrl = window.location.hostname; //www.itm2093.com this will also give same. var clicktracker_url = "/statistics/stats_tracker.php"; var demographic_url = '/survey.php'; var demographic_url_iframe = '/statistics/survey_iframe.php'; //-------------------------- For full file url path -------------------------- // // Commented this one becasue sometime trackDbStnUrl = www.itm2093.com and we are surfing site using itm2093.com // so, it will make problem // if (trackDbStnUrl && trackDbStnUrl != 'undefined') { //clicktracker_url = "http://"+trackDbStnUrl+clicktracker_url; //www.itm2093.com //demographic_url = "http://"+trackDbStnUrl+demographic_url; } if (siteUrl && siteUrl != 'undefined') { clicktracker_url = "http://"+siteUrl+clicktracker_url; //www.itm2093.com demographic_url = "http://"+siteUrl+demographic_url; if (popOver && popOver != 'undefined') { //demographic_url = '/survey.php'; //it will take current parent hostname demographic_url_iframe = "http://"+siteUrl+demographic_url_iframe; } } //------------------------------------ var clicktracker_domains = Array(""); //var clicktracker_extensions = Array("doc", "exe", "rar", "zip"); var clicktracker_extensions = Array(""); //*****This same is in global_functions.js file. but if it will not get from there than it will use here************* function function_exists( function_name ) { if (typeof function_name == 'string') { return (typeof window[function_name] == 'function'); } else { return (function_name instanceof Function); } }//End of function function_exists /* * Name: * createStatCookie * * Description: * writes a cookie on the client's computer * * Preconditions: * - name: name of the cookie that will hold the value * - value: the value to be stored in the cookie * * Postconditions: * - the cookie is written * * Functions: * - None * * Log: * Nilesh Prajapati 23 May 2008 * - Creation * */ if (!function_exists('createStatCookie')) { function createStatCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }// End function = createStatCookie } /* * Name: * readStatCookie * * Description: * read a cookie from the client's computer * * Preconditions: * - key: name of the cookie that holds the value * * Postconditions: * - the cookie value is returned if it exists, otherwise null is returned * * Functions: * - None * * Log: * Nilesh Prajapati 23 May 2008 * - Creation * */ if (!function_exists('readStatCookie')) { function readStatCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }// End function - readStatCookie } /* * Name: * eraseStatCookie * Log: * Nilesh Prajapati 23 May 2008 * - Creation */ if (!function_exists('eraseStatCookie')) { function eraseStatCookie(name) { createStatCookie(name,"",-1); }//End of function eraseStatCookie } // ***** clicktracker_inarray ***** function clicktracker_inarray(arr, val) { for (var i in arr) if (arr[i] == val) return true; return false; }//End of function clicktracker_inarray // ***** clicktracker_innerText ***** function clicktracker_innerText(str) { str = str.replace(/<[^>]*>/g, ' '); str = str.replace(/ /g, ' '); str = str.replace(/^\s+/g, ''); str = str.replace(/\s+$/g, ''); return str; }//End of function clicktracker_innerText // ***** URL ******************************************************************* var clicktracker_re_scheme = "^\\w+://"; var clicktracker_re_folder = "((?:-|\\w|\\.)*)"; var clicktracker_re_domain = clicktracker_re_scheme+ clicktracker_re_folder; var clicktracker_re_folders = clicktracker_re_domain+"(?:/"+clicktracker_re_folder+')*'; // ***** clicktracker_domain ***** function clicktracker_domain(url) { var reg = new RegExp(clicktracker_re_domain); var match = reg.exec(url); if (!match) return ""; match = match[match.length-1]; return match; }//End of function clicktracker_domain // ***** clicktracker_extension ***** function clicktracker_extension(url) { var reg = new RegExp(clicktracker_re_folders); var match = reg.exec(url); if (!match) return ""; match = match[match.length-1].split("."); return (match.length >= 2) ? match[match.length-1] : ""; }//End of function clicktracker_extension // ***** Track ***************************************************************** // ***** clicktracker_aux ***** // here: url -> means the link contains into the anchor tag during click // title -> means the text showing (lable) of anchor tag. // function clicktracker_aux(url, title, linkObj) { extraParam = 'clicked=true&'; //this will identify whether we click to any link on page or not. // // This will contains the actual page URL on which links are available to click. // //var page_URL = url; //it will get the current visited url link var page_URL = escape(d.URL); if (page_URL) { extraParam += 'refPage='+page_URL+'&'; // get the referral Page means actual page link. } queryParam = createQueryStringForStnPageInfo('click'); //it will get the value of stnPageId. because we have passed flag=click extraParam += queryParam; // // For to get the station box id and stn page column id // resultArr = getStnBoxInfoOnClick(tagObj); stnBoxIdVal = resultArr['stnBoxId']; stnPageColumnIdVal = resultArr['stnPageColumnId']; contentIdVal = resultArr['contentId']; contentTypeIdVal = resultArr['contentTypeId']; groupIdVal = resultArr['groupId']; if (stnBoxIdVal && stnPageColumnIdVal) { extraParam += 'sBI='+stnBoxIdVal+'&'; extraParam += 'sPCI='+stnPageColumnIdVal+'&'; } if (contentIdVal && contentTypeIdVal) { extraParam += 'cNId='+contentIdVal+'&'; extraParam += 'cNTId='+contentTypeIdVal+'&'; extraParam += 'grpId='+groupIdVal+'&'; } //----------For ITunes button click first it will go to rss file and from that enclose url will give actual itunes url------ // // it will get value on the onclick of button of itunes from the hidden variable "trackPodcastIndividual" // which we defined into the recent_episode.lib file. // episodeIdVal = resultArr['episodeId'] podcastItemIdVal = resultArr['podcastItemId']; if (episodeIdVal) { extraParam += 'epId='+episodeIdVal+'&'; extraParam += 'pIId='+podcastItemIdVal+'&'; //for some episode podCastItemId might be 0 // // if we donot allowd this iTunes from here means at the same page itunes button than comment this code. // added false to not allow to insert the records of 4th button podcast rss into ItunesTrack table. // right now no need to open this code so, it will add the value into the StatClick table only /*if(isITunesURL(url) && false) { //if it will find this iTunes=true than it will insert into the "ItunesTrack" table extraParam += 'iTunes=true&'; }*/ // // this is for when we will click podcast button because now we have to store first record into the podCastStatUser table // and than statClick table. // buttonClick = getPodCastTrackInfo(url); if(buttonClick) { extraParam += 'btn='+buttonClick+'&'; podClick = true; } }//End of condition if (episodeIdVal) //------------------------------- // // At the time of click any button // if (trackStatsAllow && trackStatsAllow != 'undefined') { if(podClick) { tracker = false; //stop podcast tracking from here... because now we have direct code in particular file like sybase podcast tracking //because of 3rd party js error problem for VX-2565 } else { extraParam += 'trackAllow=true&'; tracker = true; } } else if (trackDragDropAllow && trackDragDropAllow != 'undefined') { extraParam += 'trackAllow=false&'; tracker = true; } else if(podClick) { extraParam += 'trackAllow=false&trackDragDrop=false&'; //tracker = true; tracker = false; //added here false to stop the podcast tracking from the js code //and allow it from the particular file calling..... //like episode_download.php file. } paramArr = new Array(); paramArr['allowRF'] = 0; //here put the 0 because we are getting it above "refPage=" queryStr = getJSClientInfo(paramArr); // if we want other information related to browser. //other than we can get this information from the $_SERVER things. //to decrease the length of the get query string. if (!debugStr) { //send request using Image var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; } else if(tracker) { //sending request using ajax // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; //displayUrlInformation(fullURL); showHintAjax(fullURL); } }//End of function clicktracker_aux function getPodCastTrackInfo(url) { if (url && url != 'undefined') { url= unescape(url); if(url.match(/\/podcast\//)) { return 'rss'; //itpc://www.1010wins.com/pages/podcast/8888.rss } else if(url.match(/itpc:/)) { return 'rss'; //for external link: "itpc://feeds.tarot.com/f/ws/astrology/horoscope/daily/?partner=khits&key=8b30efa44850b8d1&type=rss" } else if (url.match(/type=rss/)) { return 'rss'; //for external link: } else if(url.match(/openPlayer/)) { return 'play'; } else if(url.match(/episode_download.php/)) { return 'download'; } else if(url.match(/podcast_chooser.php/)) { //http://imgsrv.1010wins.com/image/wins/box_imgs/FeatureGroup/podcast_button.gif return 'subscribe'; } else if(url.match(/openSubscribeWindow/)) { return 'subscribe'; } } return ''; }//End of function getPodCastTrackInfo // // Made the seperate function for iTunes // so, it will not make any problem with click the link. // function clickitunestracker_aux(url, title, linkObj) { extraParam = 'iTunes=true&'; //this will identify whether we click to any link on page or not. // // This will contains the actual page URL on which links are available to click. // //var page_URL = url; //it will get the current visited url link var page_URL = escape(d.URL); if (page_URL) { extraParam += 'refPage='+page_URL+'&'; // get the referral Page means actual page link. } audioFileUrl = getAudioFileUrl(url); if(audioFileUrl) { extraParam += 'audUrl='+audioFileUrl+'&'; } paramArr = new Array(); paramArr['allowRF'] = 0; //here put the 0 because we are getting it above "refPage=" queryStr = getJSClientInfo(paramArr); // if we want other information related to browser. //other than we can get this information from the $_SERVER things. //to decrease the length of the get query string. if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; } else { // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+url+"&title="+title+"&rand="+Math.random()+queryStr; showHintAjax(fullURL); } }//End of function clickitunestracker_aux // // check the whether the .rss url of button is for itunes or not. // function isITunesURL(url) { //from recent_episodes.lib file. //itpc://www.itm2093.com/pages/podcast/33577.rss if (url && url != 'undefined') { if(url.match(/\/podcast\//)) { //if it will find podcast folder return true; } } return false; }//End of function isITunesURL function getAudioFileUrl(urlVal) { //http://itm2093.com/podcast_track.mp3?url=http://podcast.wcbs880.com/wcbs/1115484.mp3&statUserId=&demoUserId= //for to get the value from the url. //regex = /http:\/\/[a-z0-9]+\.[a-z0-9]+\.[a-z]{3}\/[a-z]+\/[0-9]+\.[a-z0-9]+/ig; //regex = /url=.+\&/ig; //regex = /=(http|https|ftp):\/\/.+\/.+\.(mp3|rm)+/ig; regex = /=(http|https|ftp):\/\/.+\/.+\.[a-z0-9]+/ig; //if escaped value than unescaped it here urlVal = unescape(urlVal); if (urlVal.match(regex)) { audioUrl = RegExp['$&']; audioUrl = audioUrl.substr(1, audioUrl.length); //if we will use regx with = http: than only needed return escape(audioUrl); } else { return ''; } }//End of function getAudioFileUrl function redirectToAudioUrl() { var page_URL = escape(d.URL); audioFileUrl = getAudioFileUrl(page_URL); if(audioFileUrl) { audioFileUrl = unescape(audioFileUrl); window.location = audioFileUrl; return true; } return false; }//End of function redirectToAudioUrl // ***** clicktracker ***** function itunesTracker(e) { var ie = navigator.appName == "Microsoft Internet Explorer"; var src = ie ? window.event.srcElement : e.target; var tag = (src.tagName.toLowerCase() != "a") ? src.parentNode : src; eltTag = tag.tagName; eltTag = (eltTag) ? eltTag.toLowerCase() : ''; if (!tag || eltTag != "a") return; domain = clicktracker_domain (tag.href); extension = clicktracker_extension(tag.href); if ( clicktracker_inarray(clicktracker_domains, domain) && !clicktracker_inarray(clicktracker_extensions, extension)) return; var url = tag.href; var title = ''; if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.innerHTML); if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.title); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText(src.alt); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText("Image"); // // This is for close link , and didnot allow it into database for to store. // Close // if (url) { if(url.toLowerCase() == 'javascript:void(0);' || url.toLowerCase() == 'javascript:void(0)') { url = ''; if (tag.onclick) { url = tag.onclick; } if(title && title != 'undefined') { if (title.toLowerCase() == 'close') { url = ''; } } } }//End of if (url) url = escape(url); title = escape(title.substr(0, 150)); tagObj = tag; if (url && title) setTimeout("clickitunestracker_aux('"+url+"', '"+title+"' , tagObj)", 10); return; }//End of function itunesTracker // // This function will call when we click on any link of the page. // var previousLinkVal = ''; function clicktracker(e) { //evt = (e) ? e : window.event; //Start check if event button 2 is clicked or not. //right click of mouse //if(evt.button == 2){ //}//End check if event button 2 is clicked or not. // Detect issuing element. //var srcElt = (e.target) ? e.target : e.srcElement; /*var eltId; var eltTag; var eltType; // Obtain Information about the sending element. means delete this item button on property window eltId = srcElt.id; eltTag = srcElt.tagName.toLowerCase(); eltType = srcElt.type;*/ var ie = navigator.appName == "Microsoft Internet Explorer"; var src = ie ? window.event.srcElement : e.target; var tag = (src.tagName.toLowerCase() != "a") ? src.parentNode : src; eltTag = tag.tagName; eltTag = (eltTag) ? eltTag.toLowerCase() : ''; //if (!tag || tag.tagName.toLowerCase() != "a") return; if (!tag || eltTag != "a") return; domain = clicktracker_domain (tag.href); extension = clicktracker_extension(tag.href); if ( clicktracker_inarray(clicktracker_domains, domain) && !clicktracker_inarray(clicktracker_extensions, extension)) return; var url = tag.href; var title = ''; if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.innerHTML); if (!title) if (tag.tagName.toLowerCase() == "a") title = clicktracker_innerText(tag.title); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText(src.alt); if (!title) if (src.tagName.toLowerCase() == "img") title = clicktracker_innerText("Image"); // // This is for close link , and didnot allow it into database for to store. // Close // if (url) { if (popOver && popOver != 'undefined') { var urlOnclick = ''; if (tag.onclick) { urlOnclick = tag.onclick } //var myRegExp = /close/; //var matchPos1 = url.search(myRegExp); if (urlOnclick) { idLink = tag.id; if (idLink && idLink != 'undefined') { if (idLink == 'closeIframeLink') { return; } } /*var myRegExp = /hideIFramePanel/; var matchPos1 = urlOnclick.search(myRegExp); if(matchPos1 != -1) { alert("There was a match at position " + matchPos1); return; } else { alert("There was no match in the first string"); }*/ } }//End of condition if (popOver && popOver != 'undefined') if(url.toLowerCase() == 'javascript:void(0);' || url.toLowerCase() == 'javascript:void(0)') { url = ''; //this is for to allow insertion of records if there is external link on to feature group to open into new window. if (tag.onclick) { url = tag.onclick; } if(title && title != 'undefined') { if (title.toLowerCase() == 'close') { url = ''; } } } }//End of if (url) //url = escape(url .substr(0, 150)); url = escape(url); title = escape(title.substr(0, 150)); tagObj = tag; //here tag is the anchor tag object //tag.href // // trackDemoGraphInfomation you will get it from the create_stn_page.php file. // and this whole above function will called during click only. // if (trackDemoGraphInfomation && trackDemoGraphInfomation != 'undefined') { demoGraphInfoArray = trackDemoGraphInfomation.split('-'); isActive = parseInt(demoGraphInfoArray[0]); //means 1 clickNo = parseInt(demoGraphInfoArray[1]); skippedHour = parseInt(demoGraphInfoArray[2]); if (clickNo > 0) { clickNo = clickNo - 1; //for on exect click no popup should open. } else { clickNo = ''; } //alert(isActive + ' -- ' + clickNo + ' -- ' + demographic_url); if (isActive && isActive > 0) { var noOfLinkClickCookieVal = readStatCookie('noOfLinkClick'); //noOfLinkClickCookieVal = 1000; var skippedHourCookieVal = readStatCookie('skippedHour'); //if (noOfLinkClickCookieVal == clickNo && (skippedHourCookieVal == 'null' || skippedHourCookieVal == null || skippedHourCookieVal == '' ) ) { if (noOfLinkClickCookieVal == clickNo) { previousLinkVal = escape(tagObj.onclick); tagObj.onclick = function () { return false; } //tagObj.onclick = 'return false;'; //tagObj.addEventListener('click', function () { return false; } , true); //check with false param at last arg if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } setTimeout("setLinkUrlAgain('"+previousLinkVal+"', tagObj)", 2000); return false; }//End of if (noOfLinkClickCookieVal == clickNo) }//End of condition if (isActive && isActive > 0) }//End of condition if (trackDemoGraphInfomation && trackDemoGraphInfomation != 'undefined') if (url && title) setTimeout("clicktracker_aux('"+url+"', '"+title+"' , tagObj)", 10); return; }//End of function clicktracker function setLinkUrlAgain(url , tagObj) { if (url && url != 'undefined') { tagObj.onclick = url; } else { tagObj.onclick = ''; } }//End of function setLinkUrlAgain // ***** Attach Events ********************************************************* //this onclick will set at the last of page load from the create_stn_page.php file. //to avoid the dublicate entry on single click. because in our case we have .js multiple times into single page. // // in the http://www.itm2093.com/podcast_track.php we have trackItunes=true while setOnClick=flase; // if (trackItunes && trackItunes != 'undefined') { if (navigator.appName == "Microsoft Internet Explorer") { //document.attachEvent('onclick', itunesTracker); //document.attachEvent("oncontextmenu", itunesTracker); //right click document.attachEvent("onmousedown", itunesTracker); } else { document.addEventListener('click', itunesTracker, true); } } if (setOnClick && setOnClick != 'undefined') { if (navigator.appName == "Microsoft Internet Explorer") { //If we open the link in the tab (clicking mouse wheel or open in new window using right //mouse click and chossing in option which is general tendency now days to open the click) //the clicks are not registered i had this problem in IE7 //document.attachEvent ('onclick', clicktracker); //document.attachEvent("oncontextmenu", clicktracker); //right click document.attachEvent("onmousedown", clicktracker); } else { //document.addEventListener('click', clicktracker, false); document.addEventListener('click', clicktracker, true); //because now we used tagObj.onclick during isActive checking } } //***** For to track the page view ************************************************ // // This function will call during the page loading // At this time visitPage and referralPage both are same. // and we will not get value of clicked=true. because this will called directly during page load. // function getVisitedUrlInfo(infoArray,reqIndex) { var extraParam = ''; var queryStr = ''; var queryParam = ''; var page_URL = escape(d.URL); //it will get the current visited url link var page_Title = escape(d.title); //it will get the page title if (!page_Title) { page_Title = 'NoPageTitle'; } // // if it is true than only need to add into statView table // if (trackStatsAllow && trackStatsAllow != 'undefined') { queryParam = createQueryStringForStnPageInfo('view',infoArray); extraParam = queryParam; extraParam += '&trackAllow=true&'; paramArr = new Array(); paramArr['allowRF'] = 1; queryStr = getJSClientInfo(paramArr); //we can get this information from the $_SERVER to reduce the length of get query string tracker = true; } //here trackDragDrop is true. else if (trackDragDropAllow && trackDragDropAllow != 'undefined') { //this will helpful during drag and drop things where we need only statUserId even if statVisitor allow set to false. //and at the time of podcast tracking because in old podcast tracking we donot have statVisitor allow true/false option at backend side. extraParam = 'createStatUser=true&trackAllow=false&'; //only need to add the statUserId in cookie tracker = true; //here we need because we are creating the statUserId first time from the stats_tracker.php file and after //creating we are updating its last time in StatUser table. } else { //only allow podcast things means four button but without statUserId creation means if in cookie than it will store otherwise it will take 0 extraParam = 'trackAllow=false&trackDragDrop=false&'; tracker = false; //no need to send the request to server means site_traker.php file at the time of view. if both are false } if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; } else if (tracker) { // // This is for just debug whole output to main sample file. // fullURL = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; //displayUrlInformation(fullURL); if (reqIndex >= 0) { showHintAjax_Multiple(fullURL,reqIndex); } else { showHintAjax(fullURL); } } // // This is to pass the stmBoxId and stnPageColumnId into the current url for view. // //appendStnBoxInfoToLinks(); }//End of function getVisitedUrlInfo function dumpFunction() { var statUserIdCookieVal = readStatCookie('statUserId'); if (statUserIdCookieVal && statUserIdCookieVal != 'undefined') { // // if cookie of statUserId is set properly during getVisitedUrlInfo() for whole stnPageInfo than only // need to allow to add the information for trackArray things. for(x in trackArray) { arrayVal = trackArray[x]; getVisitedUrlInfo(arrayVal,x); //setTimeout('getVisitedUrlInfo(arrayVal,x)',1); } } else { setTimeout('dumpFunction()',1); } }//End of function dumpFunction // // this function call during page load of podcast_track.php file // because in that we have set trackItunes = true and setOnClick = false; // function getVisitedPodCastUrlInfo() { var extraParam = ''; extraParam = 'iTunes=true&'; //at the time of view or click of podcast_track.php file it will set iTunes=true var queryStr = ''; var queryParam = ''; var page_URL = escape(d.URL); //it will get the current visited url link var page_Title = escape(d.title); //it will get the page title if (!page_Title) { page_Title = 'NoPageTitle'; } audioFileUrl = getAudioFileUrl(page_URL); if(audioFileUrl) { extraParam += 'audUrl='+audioFileUrl+'&'; } paramArr = new Array(); paramArr['allowRF'] = 1; queryStr = getJSClientInfo(paramArr); //we can get this information from the $_SERVER to reduce the length of get query string if (!debugStr) { var img = new Image(); img.src = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; } else { fullURL = clicktracker_url+"?"+extraParam+"url="+page_URL+"&title="+page_Title+"&rand="+Math.random()+queryStr; showHintAjax(fullURL); } }//End of function getVisitedPodCastUrlInfo //trackItunes= flase into the create_stn_page.php file if (trackItunes && trackItunes != 'undefined') { //if it will get trackItunes=true from the stationUrl/podcast_track.php file than no need to add entry into the StatView table. getVisitedPodCastUrlInfo(); //during loading of podcast_track.php file this function will called } else { // // This is for to store station page //setTimeout('getVisitedUrlInfo()',1); // This function is used to track the view during page load of page getVisitedUrlInfo(); } // // trackArray will get the value from the feature_group.lib file. // if (trackStatsAllow && trackStatsAllow != 'undefined') { if (trackArray && trackArray != 'undefined') { // // For first request upto cookie is not set no need to allow called getVisitedUrlInfo funcation for trackArray // setTimeout('dumpFunction()',1); /* //for checking multiple records. infoArray = new Array(); infoArray['trackDbInfo'] = "70111-64158-2"; infoArray['trackContentInfo'] = "66825-4-9811-91856,91852"; try{ trackArray[trackArray.length] = infoArray; }catch(e){}*/ }//End of condition if (trackArray && trackArray != 'undefined') } var skippedHourVal; // // Function for to open the popup automatically after the no of hour set from the backend. // function checkCookie() { demoUserIdVal = readStatCookie('demoUserId'); if (demoUserIdVal && demoUserIdVal != 'undefined') { //if demo user Id set than no need to open the popup //means particular user already set the response for the demographic popup. } else { var date = new Date(); current_hour = date.getHours(); //Number of hours (0-23) current_day = date.getDate(); current_month = date.getMonth(); current_year = date.getFullYear(); checkVal = current_month+'/'+current_day+'/'+current_year+':'+current_hour; skippedHourVal = readStatCookie('skippedHour'); currentDateInfoArray = new Array(); skippedDateInfoArray = new Array(); if (checkVal && skippedHourVal) { currentDateInfoArray = checkVal.split(':'); skippedDateInfoArray = skippedHourVal.split(':'); } if(skippedHourVal == checkVal) { //excet time popup will open. if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } }else{ // // if current date greater than cookie set date and popup will not open than need to open popup directly. // if (currentDateInfoArray && skippedDateInfoArray) { if( (Date.parse(currentDateInfoArray[0]) >= Date.parse(skippedDateInfoArray[0])) && ( parseInt(currentDateInfoArray[1]) > parseInt(skippedDateInfoArray[1]) ) ) { if (popOver && popOver != 'undefined') { openPopOver(); } else { openPopup(); } } else { window.setTimeout( "checkCookie()", 1000); } } else { window.setTimeout( "checkCookie()", 1000); } }//End of condition if(skippedHourVal == checkVal) }//End of condition if (demoUserIdVal && demoUserIdVal != 'undefined') }//End of function checkCookie function openPopup() { var demoOpenedCookieVal = readStatCookie('demoOpened'); if (demoOpenedCookieVal == 1 && demoOpenedCookieVal != 'undefined') { //to avod the opening of the demo popup as many tab or pages open of intertech site.. after some specific time //because pages are checking the time to open the popup demographic user and all have its own childs. } else { createStatCookie('demoOpened',1,3650); window.open(demographic_url,'DemoGraphPopup','height=450,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes'); } }//End of function openPopup function openPopOver() { //using light window window script.. defined into create_stn_page.php file..... //myLightWindow.createWindow(tagObj); exampleCreated = true; //myLightWindow.activateWindow({href: 'http://stickmanlabs.com/images/kevin_vegas.jpg', title: 'Waiting for the show to start in Las Vegas', author: 'Jazzmatt', caption: 'Mmmmmm Margaritas! And yes, this is me...', left: 300}); //directly putting iframe inside the create_stn_page.php file.... if (window.frames["popupIframe"] && window.frames["popupIframe"] != 'undefined') { inputParam = new Array(); inputParam['iframeName'] = 'popupIframe'; //name and id should be same inputParam['iframeObj'] = window.frames["popupIframe"]; inputParam['iframeWidth'] = 360; inputParam['iframeHeight'] = 490; inputParam['iframeURL'] = demographic_url; inBuiltIframeCall(inputParam); } //demographic_url = 'http://'+ document.domain +demographic_url; //alert(demographic_url); //callToServer(demographic_url,360,490,false); //dynamic iframe generation //alert(demographic_url_iframe); //callToServer(demographic_url_iframe,360,490,true); }//End of function openPopOver checkCookie(); //***** get all client info using js ************************************************ function getJSClientInfo(paramArr) { var pageQueryStr = ''; //var page_URL = d.URL; //it will get the current visited url link //var page_Title = d.title; //it will get the page title //document.body.clientWidth or window.innerWidth //window.onresize=new Function("resizeDiv()"); var t = new Date(); //var pageQueryStr="http"+(d.URL.indexOf('https:')==0?'s':'')+"://siteURLHere.com/fileName.php?param1=val1¶m2="+val2; //if we click any link of the page than we donot need this extra things in get url to decrease the size of get url //so, during clicktracker_aux function i am passing it as flase. if (paramArr['allowRF']) { // // we need to get the referrer page using javascript // because $_SERVER['HTTP_REFERER'] will not help us to get the referrer url things if we comes from the google. // pageQueryStr += "&rf="+escape(parent == self ? d.referrer : top.d.referrer); //alert(window.opener.location); //it is giving error Location.toString //alert(window.opener.location.href); /*if (d.referrer || top.d.referrer) { //if not find this way than we will go for else condition } else { //Right Now we donot need it later we will check //this is for IE.. and in special case like //Our Station Page //means we are opning the our page into the new window using window.open method if (window.opener && window.opener != 'undefined') pageQueryStr += "&rf="+escape(window.opener.location); }*/ }//End of condition if (paramArr['allowRF']) pageQueryStr += "&tz="+escape(t.getTimezoneOffset()); pageQueryStr += "&ch="+escape(t.getHours()); pageQueryStr += "&ul="+escape(navigator.appName=="Netscape" ? navigator.language : navigator.userLanguage); if(typeof(screen)=="object") { pageQueryStr += "&sr="+screen.width+"x"+screen.height; pageQueryStr += "&cd="+screen.colorDepth; pageQueryStr += "&jo="+(navigator.javaEnabled() ? "Yes" : "No"); } //alert(navigator.appVersion + ' -- ' + navigator.userAgent); //this same we can get from the $_SERVER['HTTP_USER_AGENT']; //right now stop it but donot delete it. //pageQueryStr += "&br="+detectBrowserType(); return pageQueryStr; }//End of function getJSClientInfo //***** get stnbox id and stn page column id from the link object ********************************* /* * Name: * getStnBoxInfoOnClick * * Description: * * Preconditions: * * Postconditions: * * Log: * Prajapati Nilesh 13 May 2008 * - Creation. */ function getStnBoxInfoOnClick(tagObj) { resultArr = new Array(); stnBoxId = 0; stnPageColumnId = 0; blurbIdVal = 0; contentIdVal = 0; contentTypeIdVal = 0; groupIdVal = 0; contentInfoIndividualVal = 0; podCastInfoIndividualVal = 0; resizeColumnDivObj = null; if (tagObj && tagObj != 'undefined') { //(tagObj.previousSibling.nodeName) var p = tagObj; /*while(1){ p = p.parentNode; if(!p || p.nodeType != 1){ break; }else{ alert(p.parentNode); } }*/ var isStnBoxId = false; var isContentInfo = false; var isPodcastInfo = false; //while(typeof(p.parentNode) == 'object' && p.parentNode) { while(typeof(p) == 'object' && p) { if (p && p != 'undefined') { eltTag = p.tagName; //p.nodeName eltTag = (eltTag) ? eltTag.toLowerCase() : ''; cssClassName = p.className; if (cssClassName && cssClassName != 'undefined' && !isStnBoxId) { splitArray = cssClassName.split('_'); boxLabel = splitArray[0]; //Box string contains here if (boxLabel.toLowerCase() == 'box') { stnBoxId = splitArray[1]; //Box_60777_Headline this is our class formate isStnBoxId = true; //break; //donot put break here because we need to search stnPageColumnId id also } } // // For to get individual information means featureInfo inside particular featureGroupId // if (eltTag == 'td' && !isContentInfo) { trackContentIndividualHiddenId = 'trackContentIndividual[]'; trackPodcastIndividualHiddenId = 'trackPodcastIndividual[]'; trackContentIndividualHiddenColl = p.getElementsByTagName('input'); for (eltIndex = trackContentIndividualHiddenColl.length - 1; eltIndex >= 0; eltIndex--) { currentElt = trackContentIndividualHiddenColl[eltIndex]; if (currentElt && currentElt != 'undefined') { //trackPodcastIndividual[] this should be first checking than the trackContentIndividual[] if (currentElt.type.toLowerCase() == 'hidden' && currentElt.id == trackPodcastIndividualHiddenId) { podCastInfoIndividualVal = currentElt.value; isPodcastInfo = true; //no need break here. } if (currentElt.type.toLowerCase() == 'hidden' && currentElt.id == trackContentIndividualHiddenId) { contentInfoIndividualVal = currentElt.value; isContentInfo = true; break; //only break this current loop of td. } } }//End of for loop }//End of condition if (eltTag == 'td') //for to find the stnPageColumnId from the // //