Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit c58ba77

Browse files
fblundunalexanderdean
authored andcommitted
Added trackSocialInteraction method
1 parent 0ace84f commit c58ba77

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

core/lib/core.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,31 @@ function trackerCore(base64, callback) {
527527
})
528528
};
529529

530+
return trackUnstructEvent(eventJson, context, tstamp);
531+
},
532+
533+
/**
534+
* Track a social event
535+
*
536+
* @param string action Social action performed
537+
* @param string network Social network
538+
* @param string target Object of the social action e.g. the video liked, the tweet retweeted
539+
* @param string pagepath the URL of the page where the action occurred
540+
* @param array Custom contexts relating to the event
541+
* @param number tstamp Timestamp of the event
542+
* @return object Payload
543+
*/
544+
trackSocialInteraction: function (action, network, target, pagepath, context, tstamp) {
545+
var eventJson = {
546+
schema: 'iglu:com.snowplowanalytics.snowplow/social_interaction/jsonschema/1-0-0',
547+
data: removeEmptyProperties({
548+
action: action,
549+
network: network,
550+
target: target,
551+
pagepath: pagepath
552+
})
553+
};
554+
530555
return trackUnstructEvent(eventJson, context, tstamp);
531556
}
532557
};

0 commit comments

Comments
 (0)