Skip to content

Commit

Permalink
feat: log create form failure on GA (#505)
Browse files Browse the repository at this point in the history
* feat: log create form failure on GA

* feat: add userEmail to log
  • Loading branch information
tshuli authored Oct 26, 2020
1 parent 5715eac commit 9823124
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/public/modules/core/services/gtag.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ function GTag(Auth, $rootScope, $window) {
}
}

/**
* Logs an admin user's failure to create form
* @param {Object} form The form object
* @return {Void}
*/
gtagService.createFormFailed = () => {
_gtagEvents('create_form', {
event_category: 'Create Form',
event_action: 'Create Form failed',
event_label: getUserEmail(),
})
}

/**
* Logs an admin user landing on the Examples tab.
* @return {Void}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function CreateFormModalController(
if (errorResponse && errorResponse.data) {
Toastr.error(errorResponse.data.message)
}
GTag.createFormFailed()
}

vm.createNewForm = function () {
Expand Down Expand Up @@ -301,6 +302,7 @@ function CreateFormModalController(
}
} else {
Toastr.error('An error occurred creating the form, please try again')
GTag.createFormFailed()
}
}

Expand Down

0 comments on commit 9823124

Please sign in to comment.