mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-22 02:04:31 +00:00
Track v2 onboard events
Added events to the v2 banner to track on Metabase and Google Analytics.
This commit is contained in:
parent
216b17ab92
commit
b2c7bb9d95
4 changed files with 48 additions and 6 deletions
|
@ -74,7 +74,7 @@ block content
|
||||||
|
|
||||||
include ../translations/translation_message
|
include ../translations/translation_message
|
||||||
|
|
||||||
.project-list-content
|
.project-list-content(event-tracking=settings.overleaf ? "loads_v2_dash" : "", onboard=settings.overleaf ? "true" : "", event-tracking-trigger=settings.overleaf ? "load" : "", event-tracking-mb="true", event-segmentation="{location: 'dash', v2_onboard: true}")
|
||||||
.row.project-list-row(ng-cloak)
|
.row.project-list-row(ng-cloak)
|
||||||
.project-list-container(ng-if="projects.length > 0")
|
.project-list-container(ng-if="projects.length > 0")
|
||||||
.project-list-sidebar-wrapper.col-md-2.col-xs-3
|
.project-list-sidebar-wrapper.col-md-2.col-xs-3
|
||||||
|
|
|
@ -6,13 +6,13 @@ if (user.awareOfV2 && !settings.overleaf)
|
||||||
.col-xs-12
|
.col-xs-12
|
||||||
.alert.alert-info
|
.alert.alert-info
|
||||||
.notification_inner
|
.notification_inner
|
||||||
.notification_body
|
.notification_body(event-tracking="sees_v2_banner" event-tracking-mb="true" event-segmentation="{location: 'welcome', v2_onboard: true}" event-tracking-trigger="load" event-tracking-send-once="true")
|
||||||
a.btn.btn-info.btn-sm.pull-right(href="/user/login_to_ol_v2") Try Overleaf v2
|
a.btn.btn-info.btn-sm.pull-right(event-tracking="go_to_v2" event-tracking-mb="true" event-segmentation="{location: 'welcome', v2_onboard: true}" event-tracking-trigger="click" href="/user/login_to_ol_v2") Try Overleaf v2
|
||||||
| ShareLaTeX is joining Overleaf and will become <em>Overleaf v2</em> in late 2018 (<a href="https://www.overleaf.com/help/342-overleaf-v2-faq">read more</a>).
|
| ShareLaTeX is joining Overleaf and will become <em>Overleaf v2</em> in late 2018 (<a event-tracking="click_v2_read_more" event-tracking-mb="true" event-segmentation="{location: 'welcome', v2_onboard: true}" event-tracking-trigger="click" href="https://www.overleaf.com/help/342-overleaf-v2-faq">read more</a>).
|
||||||
<br/>
|
<br/>
|
||||||
| We’re beta testing Overleaf v2 now and you can try it out with your ShareLaTeX account.
|
| We’re beta testing Overleaf v2 now and you can try it out with your ShareLaTeX account.
|
||||||
.notification_close
|
.notification_close
|
||||||
button(ng-click="dismiss()").close.pull-right
|
button(ng-click="dismiss()" event-tracking="closes_v2_banner" event-tracking-mb="true" event-segmentation="{location: 'welcome', v2_onboard: true}" event-tracking-trigger="click").close.pull-right
|
||||||
span(aria-hidden="true") ×
|
span(aria-hidden="true") ×
|
||||||
span.sr-only #{translate("close")}
|
span.sr-only #{translate("close")}
|
||||||
|
|
||||||
|
@ -49,4 +49,4 @@ span(ng-controller="NotificationsController").userNotifications
|
||||||
span().notification_close
|
span().notification_close
|
||||||
button(ng-click="dismiss(notification)").close.pull-right
|
button(ng-click="dismiss(notification)").close.pull-right
|
||||||
span(aria-hidden="true") ×
|
span(aria-hidden="true") ×
|
||||||
span.sr-only #{translate("close")}
|
span.sr-only #{translate("close")}
|
41
services/web/public/coffee/directives/eventTracking.coffee
Normal file
41
services/web/public/coffee/directives/eventTracking.coffee
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# For sending event data to metabase and google analytics
|
||||||
|
# ---
|
||||||
|
# by default,
|
||||||
|
# event not sent to MB.
|
||||||
|
# for MB, add event-tracking-mb='true'
|
||||||
|
# by default, event sent to MB via sendMB
|
||||||
|
# this can be changed to use sendMBOnce via event-tracking-send-once='true' attribute
|
||||||
|
# event not sent to GA.
|
||||||
|
# for GA, add event-tracking-ga attribute, where the value is the GA category
|
||||||
|
# event-tracking-trigger attribute is required to send event
|
||||||
|
|
||||||
|
define [
|
||||||
|
'base'
|
||||||
|
], (App) ->
|
||||||
|
App.directive 'eventTracking', ['event_tracking', (event_tracking) ->
|
||||||
|
return {
|
||||||
|
scope: {
|
||||||
|
eventTracking: '@',
|
||||||
|
eventSegmentation: '=?'
|
||||||
|
}
|
||||||
|
link: (scope, element, attrs) ->
|
||||||
|
sendGA = attrs.eventTrackingGa || false
|
||||||
|
sendMB = attrs.eventTrackingMb || false
|
||||||
|
sendMBFunction = if attrs.eventTrackingSendOnce then 'sendMBOnce' else 'sendMB'
|
||||||
|
segmentation = scope.eventSegmentation || {}
|
||||||
|
|
||||||
|
segmentation.page = window.location.pathname
|
||||||
|
|
||||||
|
sendEvent = () ->
|
||||||
|
if sendMB
|
||||||
|
event_tracking[sendMBFunction] scope.eventTracking, segmentation
|
||||||
|
if sendGA
|
||||||
|
event_tracking.send attrs.eventTrackingGa, attrs.eventTrackingAction || scope.eventTracking, attrs.eventTrackingLabel || ''
|
||||||
|
|
||||||
|
if attrs.eventTrackingTrigger == 'load'
|
||||||
|
sendEvent()
|
||||||
|
else if attrs.eventTrackingTrigger == 'click'
|
||||||
|
element.on 'click', (e) ->
|
||||||
|
sendEvent()
|
||||||
|
}
|
||||||
|
]
|
|
@ -24,6 +24,7 @@ define [
|
||||||
"directives/stopPropagation"
|
"directives/stopPropagation"
|
||||||
"directives/focus"
|
"directives/focus"
|
||||||
"directives/equals"
|
"directives/equals"
|
||||||
|
"directives/eventTracking"
|
||||||
"directives/fineUpload"
|
"directives/fineUpload"
|
||||||
"directives/onEnter"
|
"directives/onEnter"
|
||||||
"directives/selectAll"
|
"directives/selectAll"
|
||||||
|
|
Loading…
Reference in a new issue