Skip to content

Instantly share code, notes, and snippets.

@Danny-Driscoll
Created December 3, 2019 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danny-Driscoll/969bc9f193c0f4f3c891b374bc2f734b to your computer and use it in GitHub Desktop.
Save Danny-Driscoll/969bc9f193c0f4f3c891b374bc2f734b to your computer and use it in GitHub Desktop.
var impression_count = 0;
var count_impressions = function(logEvent){
var visitors = logEvent.params.visitors;
visitors.forEach(function(visitor){
console.log(visitor)
var snapshots = visitor.snapshots;
snapshots.forEach(function(snapshot){
var events = snapshot.events
events.forEach(function(event){
if(event.key == "campaign_activated"){
console.log(event.entity_id);
impression_count++
console.log(impression_count);
}
})
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment