-
-
Save howardr/59d3842cc123ca4771e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="mr-space" data-space-id="espn/xgamescom" style="min-height: 500px;"></div> | |
<script src="//platform.massrelevance.com/js/massrel.js"></script> | |
<script> | |
massrel.ui.load(); | |
</script> | |
<script> | |
massrel.ui.events.on('analytics', function(event) { | |
if(event.eventName === 'trackEvent') { | |
// {category},{action},{label} | |
// EXPAND | |
// viz:expand,photo,{tweet_id} | |
// viz:expand,video,{tweet_id} | |
// viz:expand,text,{tweet_id} | |
// viz:expand,status,{tweet_id} | |
// CAROUSEL NEXT/PREV | |
// viz:toggle,carousel,left | |
// viz:toggle,carousel,right | |
// viz:toggle,select | |
// SHARE | |
// twitterintent,click | |
// twitterintent,tweet | |
// twitterintent,retweet | |
// twitterintent,follow | |
// twitterintent,favorite | |
// fbintent,post | |
// fbintent,like | |
// fbintent,unlike | |
// fbintent,like-status | |
// fbintent,unlike-status | |
// SHARE ATTEMPTS (can't determine if followed through) | |
// viz:upload,uploadintent | |
// INTERACT WITH SOCIAL CONTENT | |
// tweetaction,author | |
// tweetaction,permalink | |
// tweetaction,media | |
// tweetaction,hashtag | |
// tweetaction,mention | |
// tweetaction,link | |
// tweetaction,reply | |
// tweetaction,rt | |
// tweetaction,fav | |
// fbaction,author | |
// fbaction,permalink | |
// fbaction,media | |
// fbaction,link | |
// fbaction,like | |
// fbaction,comment | |
// instaction,author | |
// instaction,link | |
var data = event.eventData; | |
data.category; | |
data.action; | |
data.label; | |
var includeEvent = includeEvents(data.category, data.action, data.label, [ | |
'viz:expand.*', | |
'viz:toggle.*', | |
'twitterintent.*', | |
'viz:upload.*', | |
'tweetaction.*', | |
'fbintent.*', | |
'!fbintent.auth', | |
'!fbintent.gated', | |
'fbaction.*', | |
'instaction.*' | |
]); | |
if(!includeEvent) { | |
return; | |
} | |
// remove console.log, and | |
// put omniture tracking here | |
console.log(data); | |
// meta data if needed | |
var metadata = event.metadata; | |
metadata.scope; // component | |
metadata.componentID; // modal | |
metadata.componentType; // modal-2 | |
metadata.pageURL; // _url of space_ | |
metadata.sourceType; // links | |
} | |
}); | |
function includeEvents(category, action, label, filters) { | |
var anyMatches = false; | |
for(var i = 0, len = filters.length; i < len; i++) { | |
var filter = filters[i]; | |
var negate = false; | |
if(filter[0] === '!') { | |
// don't capture event | |
negate = true; | |
// remove ! infront of name | |
filter = filter.slice(1, filter.length); | |
} | |
var matched = (filter === '*' || | |
category === filter || | |
category+'.*' === filter || | |
category+'.'+action === filter); | |
if(negate && matched) { | |
return false; | |
} | |
else if(!negate && matched) { | |
anyMatches = true; | |
} | |
} | |
return anyMatches; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment