Files
talk/docs/source/version-5-events.md
T
immber 8d3de4b082 [DOCS DAY] added event tracking to v5 section (#2857)
* added event tracking to v5 section

* Add SEO docs and cleanup sidebar

* Fixes raw html in SSO docs

* fixed typo on sso page

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
Co-authored-by: Vinh <vinh@vinh.tech>
2020-02-26 12:29:42 -05:00

1.2 KiB
Raw Blame History

title, permalink
title permalink
Event Tracking /v5/integrating/events/

The Coral embed script can emit events to the analytics tool of your choice. Common user actions, such as successfully posting a comment, posting a reaction, or changing a setting are all capturable with events.

Analytics Tool Integration

To enable event tracking, modify your embed script to subscribe to the events hook. You will also need to add code to your page that sends the events to your analytics system. The particular way you send this will depend on what tool youre using. Refer to your tools API and docs to determine this.

In this example, were logging all events to the console as well as sending the createComment.success event.

<script>
  const CoralStreamEmbed = Coral.createStreamEmbed({
    events: function(events) {
      events.onAny(function(eventName, data) {
        console.log(eventName, data);
        if (eventName === 'createComment.success') {
          my_event_tracker.send('createComment', data);
      });
    },
  });
</script>

Available Events

A complete list of trackable events is available on GitHub: https://github.com/coralproject/talk/blob/master/CLIENT_EVENTS.md