var metas = document.getElementsByTagName('meta'); var olyticsTag = ""; var olyticsCategory = ""; var olyticsIssue = ""; // First we see if the page has any html meta tags if(metas && metas.length > 0) { // loop through the meta tags for(var oolltt = 0; oolltt < metas.length; oolltt++) { var oollttMeta = metas[oolltt]; var theNameAttribute = oollttMeta.getAttribute('name'); // is the meta tag an 'abstract' meta tag ? if(theNameAttribute && theNameAttribute == 'abstract' && oollttMeta.getAttribute('content')) { // the meta tag is an 'abstract' meta tag - lets grab the content of the tag to use in the analytics.track call. olyticsCategory = oollttMeta.getAttribute('content'); // is the meta tag an 'keywords' meta tag ? } else if(theNameAttribute && theNameAttribute == 'keywords' && oollttMeta.getAttribute('content')) { // the meta tag is an 'keywords' meta tag - lets grab the content of the meta tag to use in the analytics.track call. olyticsTag = oollttMeta.getAttribute('content'); // is the meta tag an 'news_keywords' meta tag ? } else if(theNameAttribute && theNameAttribute == 'news_keywords' && oollttMeta.getAttribute('content')) { // the meta tag is an 'olyticsIssue' meta tag - lets grab the content of the meta tag to use in the analytics.track call. olyticsIssue = oollttMeta.getAttribute('content'); } } if(olyticsCategory.length > 0 || olyticsTag.length > 0 || olyticsIssue.length > 0) { // so at this point we have either an olyticsCategory and / or olyticsTag and / or olyticsIssue to pass in the analytics.track call. //fire the analytics.track call olytics.fire( { behaviorId: '7677H9123356A8G', category: olyticsCategory, tag: olyticsTag, issue: olyticsIssue } ); } }