- function firePromoAnalytics(e) {
- try {
- var analytics = document.getElementById("pageAnalytics");
- if (analytics) {
- var bpt = window.ga_data.route.basePageType,
- ssts = window.ga_data.route.ssts.replace('/', ':'),
- parent = getParentByTagName(e.target, 'A'),
- index = e.target.dataset.index || parent.dataset.index || 0,
- localName = e.target.dataset.moduleName || parent.dataset.moduleName || '';
- if (bpt === 'homefront') {
- ssts = 'home'
- }
- if (index && parseInt(index)) {
- index = parseInt(index);
- }
- var eventString = bpt + ':' + ssts + ':' + localName + ':' + index;
- analytics.fireEvent(eventString, {}, true);
- } else {
- if (window.newrelic) window.newrelic.noticeError('page analytics tag not found');
- }
- } catch (ex) {
- if (window.newrelic) window.newrelic.noticeError(ex);
- }
- }
- function getParentByTagName(el, tag) {
- while ((el = el.parentElement) && el.tagName !== tag);
- return el;
- }
Raw Paste