if (!ADAM$) alert('ADAM core not detected'); ADAM$.LOG = { // Logging Navigation logNavigation: function (option, controlName, controlLocation, productId, pid, gid) { var deliveryType; var custUserId; //var querystring = ADAM$.LOG.escapeQueryString(window.location.search); var querystring = window.location.search; querystring = window.location.protocol.replace(':', '-sc-') + "//".replace(/\//g, '-fs-') + window.location.host + window.location.pathname.replace(/\//g, '-fs-').replace(/content.aspx/g, '-con-') + window.location.search.replace(/\?/g, '-q-').replace(/=/g, '-eq-').replace(/&/g, '-amp-').replace(/200000/g, '-tw-').replace(/c_resname/g, '-re-').replace('productId', '-pd-'); //querystring = querystring.replace('/', '\\'); if (ADAM$.uriBase == '' || ADAM$.uriBase == undefined) ADAM$.uriBase = '//sdk.adam.com/webapi/'; if (ADAM$.siteDerivation == undefined || ADAM$.siteDerivation == '') { deliveryType = 'Static'; custUserId = 0; querystring = 'NA'; } else { deliveryType = 'Hosted'; custUserId = ADAM$.getADAMCustomerUserId() } if (productId == undefined && pid == undefined) { productId = 0; pid = 0; } else if (productId != undefined && pid == undefined) { pid = 0; } else if (productId == undefined && pid != undefined) { productId = pid; } if (gid == undefined) { gid = '200000'; } if (option == 'content') { var uri = ADAM$.uriBase + 'Analytics.svc/logging/contentPage/submit/' + +ADAM$.customerId + "/" + custUserId + "/" + deliveryType + "/" + productId + "/" + pid + "/" + gid + "/" + querystring; ADAM$.jsonpCall(uri, function (data) { if (ADAM$.SS != undefined) { ADAM$.SS.lastContentID = data; } }); } else if (option == 'control') { var uri = ADAM$.uriBase + 'Analytics.svc/logging/control/submit/' + ADAM$.customerId + "/" + custUserId + "/" + deliveryType + "/" + productId + "/" + pid + "/" + gid + "/" + controlName + "/" + controlLocation + "/" + querystring; ADAM$.jsonpCall(uri, function (data) { if (ADAM$.SS != undefined) { ADAM$.SS.lastControlID = data; } }); } }, escapeQueryString: function (str) { if (str != undefined) { str = str.replace(/=/g, '--EQUAL--'); str = str.replace('?', ''); str = str.replace(/&/g, '--AND--'); return str; } else { return '-'; } }, processControl: function (controlType, locationClicked) { ADAM$.LOG.logNavigation('control', controlType, locationClicked, ADAM$.productId, ADAM$.projectTypeId, ADAM$.genContentId); }, processContentPage: function () { ADAM$.LOG.logNavigation('content', '', '', ADAM$.productId, ADAM$.projectTypeId, ADAM$.genContentId); }, processlogMetaData: function (controlNavigationId, type, meta) { //meta = escape(meta); if (isNaN(meta)) { meta = meta.replace(':', '-sc-').replace(/\//g, '-fs-').replace(/\?/g, '-q-').replace(/=/g, '-eq-').replace(/&/g, '-amp-'); } var uri = ADAM$.uriBase + 'Analytics.svc/logging/OtherLog/submit/' + controlNavigationId + "/" + type + "/" + meta; ADAM$.jsonpCall(uri, function () { }); }, getAssClosedNodeID: function (custUserId, AssName) { var uri = ADAM$.uriBase + 'Analytics.svc/logging/assLastCloseNodeId/submit/' + custUserId + "/" + AssName; ADAM$.jsonpCall(uri, function (data) { if (data.length > 0) { ADAM$.SS.lastNodeCloseId = data[0]; //.AssLastNodeCloseId ADAM$.SS.deleteControlNavigationId = data[1]; } }); }, deleteLastClosedNode: function (custUserId, AssName, controlNavigationId) { var uri = ADAM$.uriBase + 'Analytics.svc/logging/deleteAssLastCloseNodeId/submit/' + custUserId +"/"+ AssName +"/"+ controlNavigationId; ADAM$.jsonpCall(uri, function () { }); } } // wire up $(document).ready(function () { ADAM$.LOG.processContentPage(); });