Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track all form error messages #3708

Merged
merged 1 commit into from Jan 24, 2018
Merged

Track all form error messages #3708

merged 1 commit into from Jan 24, 2018

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented Jan 23, 2018

Example event:

category: form-error
action: publication-error
label: Title can't be blank

Example markup that generates event:

<li data-module="auto-track-event" data-track-category="form-error" data-track-action="statistical-data-set-error" data-track-label="Title can't be blank">Title can't be blank</li>

Example errors that will be tracked:

screen shot 2018-01-23 at 11 26 18

Notes:

  • object.class.name.demodulize.underscore.humanize is used to present the error summary, so the dash variant will also work for keeping note of the format the error was on
  • Update strip_tags to ActionController::Base.helpers.strip_tags so it can be used anywhere

Example view of real time events being tracked:

screen shot 2018-01-23 at 11 46 15

@fofr fofr requested a review from andrewgarner Jan 23, 2018
@@ -36,7 +38,7 @@ def errors
def error_list
@template.content_tag(:ul, "class" => "errors disc") do
object.errors.full_messages.each do |msg|
@template.concat @template.content_tag(:li, msg)
@template.concat @template.content_tag(:li, msg, data: track_analytics_data('form-error', "#{object.class.name.demodulize.underscore.dasherize}-error", msg))

This comment has been minimized.

@andrewgarner

andrewgarner Jan 23, 2018
Contributor

You can calculate this outside the enumerator.

This comment has been minimized.

@fofr

fofr Jan 23, 2018
Author Contributor

Updated

Example event: ‘form-error’, ‘publication-error’, ‘Title can't be blank’
@fofr fofr force-pushed the track-error-messages branch from 0b4beaa to 6309dd5 Jan 23, 2018
@fofr fofr merged commit 2466cdb into master Jan 24, 2018
1 check passed
1 check passed
continuous-integration/jenkins/branch This commit looks good
Details
@fofr fofr deleted the track-error-messages branch Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.