The Credentials IDA uses to track events. If you set the segment_key variable in your site_configuration, a variety of events (segment API calls) will be triggered when navigating through the UI.

Analytics for legacy/template pages#


For pages with static DOM elements, we add event specific data-track-event-* HTML attributes directly, and the analytics.js script parses them on page load.

For example (from templates/_actions.html):

 <button title="{% trans 'Share this certificate via Facebook' as tmsg %} {{tmsg | htmlescape}}" class="action btn icon-only action-facebook"
        disabled data-track-type="click"
        data-track-event-property-credential-uuid="{{ user_credential.uuid }}"
        data-track-event-property-program-uuid="{{ user_credential.credential.program_uuid }}">
  <span class="fa fa-facebook" aria-hidden="true"></span>
  <span class="action-label">{% trans 'Share this certificate via Facebook' as tmsg %}{{ tmsg | htmlescape }}</span>

Analytics for react pages#


For newer react-based UIs, we use the trackEvent() function defined in Analytics.jsx. This function is intended to be added as an event listener (e.g. onClick) on a component. However, trackEvent() still relies on analytics.js being loaded on the page, as it access the segment function.

for example (from static/components/ShareProgramRecordModal.jsx)

    label={gettext('Copy Link')}
    onClick={trackEvent('', {
      category: 'records',
      'program-uuid': this.props.uuid,