mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 04:24:52 +00:00
Merge pull request #452 from sharelatex/jel-onboard-analytics
v2 onboard analytics
This commit is contained in:
commit
9ab3107cee
4 changed files with 48 additions and 6 deletions
|
@ -74,7 +74,7 @@ block content
|
|||
|
||||
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)
|
||||
.project-list-container(ng-if="projects.length > 0")
|
||||
.project-list-sidebar-wrapper.col-md-2.col-xs-3
|
||||
|
|
|
@ -6,13 +6,13 @@ if (user.awareOfV2 && !settings.overleaf)
|
|||
.col-xs-12
|
||||
.alert.alert-info
|
||||
.notification_inner
|
||||
.notification_body
|
||||
a.btn.btn-info.btn-sm.pull-right(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>).
|
||||
.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(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 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/>
|
||||
| We’re beta testing Overleaf v2 now and you can try it out with your ShareLaTeX account.
|
||||
.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.sr-only #{translate("close")}
|
||||
|
||||
|
@ -49,4 +49,4 @@ span(ng-controller="NotificationsController").userNotifications
|
|||
span().notification_close
|
||||
button(ng-click="dismiss(notification)").close.pull-right
|
||||
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/focus"
|
||||
"directives/equals"
|
||||
"directives/eventTracking"
|
||||
"directives/fineUpload"
|
||||
"directives/onEnter"
|
||||
"directives/selectAll"
|
||||
|
|
Loading…
Reference in a new issue