File tree Expand file tree Collapse file tree 5 files changed +29
-1
lines changed
pages/common/Modals/ShareModal Expand file tree Collapse file tree 5 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ModeIcons from 'app/components/ModeIcons';
55import { getModulePath } from 'common/sandbox/modules' ;
66import QRCode from 'qrcode.react' ;
77import Button from 'app/components/Button' ;
8+ import track from 'app/utils/analytics' ;
89
910import {
1011 optionsToParameterizedUrl ,
@@ -45,6 +46,10 @@ class ShareView extends React.Component {
4546 showQRCode : false ,
4647 } ;
4748
49+ componentDidMount ( ) {
50+ track ( 'share-opened' , { } ) ;
51+ }
52+
4853 handleChange = e => this . setState ( { message : e . target . value } ) ;
4954
5055 handleSend = ( ) => {
Original file line number Diff line number Diff line change 11import { sequence , parallel } from 'cerebral' ;
22import { set , when } from 'cerebral/operators' ;
33import { state , props } from 'cerebral/tags' ;
4+ import { track as trackAnalytics } from 'app/utils/analytics' ;
45import * as actions from './actions' ;
56
67export function addTabById ( id ) {
@@ -34,6 +35,22 @@ export function addTabById(id) {
3435 } ;
3536}
3637
38+ const trackedEvents = { } ;
39+
40+ export function track ( e , args , { trackOnce } = { trackOnce : false } ) {
41+ return ( ) => {
42+ if ( ! trackOnce || ! trackedEvents [ e ] ) {
43+ trackAnalytics ( e , args ) ;
44+
45+ if ( trackOnce ) {
46+ trackedEvents [ e ] = true ;
47+ }
48+ }
49+
50+ return { } ;
51+ } ;
52+ }
53+
3754export function setCurrentModuleById ( id ) {
3855 // eslint-disable-next-line
3956 return function setCurrentModuleById ( { state, resolve } ) {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818 closeModal ,
1919} from '../../sequences' ;
2020
21- import { setCurrentModule , addNotification } from '../../factories' ;
21+ import { setCurrentModule , addNotification , track } from '../../factories' ;
2222
2323export const openQuickActions = set ( state `editor.quickActionsOpen` , true ) ;
2424
@@ -116,6 +116,7 @@ export const forceForkSandbox = [
116116] ;
117117
118118export const changeCode = [
119+ track ( 'change-code' , { } , { trackOnce : true } ) ,
119120 actions . setCode ,
120121 actions . addChangedModule ,
121122 actions . unsetDirtyTab ,
@@ -140,6 +141,7 @@ export const saveChangedModules = [
140141] ;
141142
142143export const saveCode = [
144+ track ( 'save-code' , { } ) ,
143145 ensureOwnedSandbox ,
144146 when ( props `code` ) ,
145147 {
Original file line number Diff line number Diff line change @@ -361,6 +361,7 @@ export const sendSelection = [
361361] ;
362362
363363export const createLive = [
364+ factories . track ( 'create-live' , { } ) ,
364365 set ( state `live.isOwner` , true ) ,
365366 actions . createRoom ,
366367 initializeLive ,
@@ -413,6 +414,7 @@ export const removeEditor = [
413414export const sendChat = [ actions . sendChat ] ;
414415
415416export const setChatEnabled = [
417+ factories . track ( 'live-chat-enabled' , { } ) ,
416418 equals ( state `live.isOwner` ) ,
417419 {
418420 true : [
@@ -424,6 +426,7 @@ export const setChatEnabled = [
424426] ;
425427
426428export const setFollowing = [
429+ factories . track ( 'live-follow-user' , { } ) ,
427430 set ( state `live.followingUserId` , props `userId` ) ,
428431 actions . getCurrentModuleIdOfUser ,
429432 when ( props `moduleShortid` ) ,
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ export const fetchGitChanges = [
135135
136136export const signIn = [
137137 set ( state `isAuthenticating` , true ) ,
138+ factories . track ( 'sign-in' , { } ) ,
138139 actions . signInGithub ,
139140 {
140141 success : [
You can’t perform that action at this time.
0 commit comments