Skip to content

add analytics class to training #57

@spgandhi

Description

@spgandhi

Proposal - create a separate class for analytics that would be accessible via the GraphAcademyPage class.

Constraints

  1. We only want to start tracking after the user is logged in

Platforms to integrate

  1. Mixpanel
  2. Intercom

Functions -

  1. init() - initates the tracking libraries and sets identify eg: mixpanel.indentity(user_id);
  2. track(eventName, meta, platform) - platform will specify which platform to send data to. For eg, we might have a event that we want to track in Mixpanel but not in Intercom.

Sandbox Implementation:

.....
shouldTrackPlatform(options, platformName) {
	return !!(
		!options
		|| (!options.all && options[platformName])
		|| (options.all && options[platformName] !== false)
	);
}

track(eventName, meta, platform = null) {
         const shouldTrackMixPanel = this.shouldTrackPlatform(platform, 'mixpanel');
         const shouldTrackIntercom = this.shouldTrackPlatform(platform, 'intercom');

        if(shouldTrackMixpanel) ..............
        if(shouldTrackIntercom) ..............
}
.....

Possible platform values

  1. {all: false, mixpanel: true} - tracks only in mixpanel
  2. {all: true, mixpanel: false} - track everything but mixpanel

Inspired by segment.com implementation - https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#selecting-destinations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions