diff --git a/services/web/app/views/project/list.pug b/services/web/app/views/project/list.pug
index d2001c5483..75cd1eb9a7 100644
--- a/services/web/app/views/project/list.pug
+++ b/services/web/app/views/project/list.pug
@@ -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
diff --git a/services/web/app/views/project/list/notifications.pug b/services/web/app/views/project/list/notifications.pug
index 15301482a3..f173555e1c 100644
--- a/services/web/app/views/project/list/notifications.pug
+++ b/services/web/app/views/project/list/notifications.pug
@@ -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 Overleaf v2 in late 2018 (read more).
+ .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 Overleaf v2 in late 2018 (read more).
| 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")}
\ No newline at end of file
diff --git a/services/web/public/coffee/directives/eventTracking.coffee b/services/web/public/coffee/directives/eventTracking.coffee
new file mode 100644
index 0000000000..9ba2fbb647
--- /dev/null
+++ b/services/web/public/coffee/directives/eventTracking.coffee
@@ -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()
+ }
+ ]
\ No newline at end of file
diff --git a/services/web/public/coffee/main.coffee b/services/web/public/coffee/main.coffee
index de5a80ae83..951923dc35 100644
--- a/services/web/public/coffee/main.coffee
+++ b/services/web/public/coffee/main.coffee
@@ -24,6 +24,7 @@ define [
"directives/stopPropagation"
"directives/focus"
"directives/equals"
+ "directives/eventTracking"
"directives/fineUpload"
"directives/onEnter"
"directives/selectAll"