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

Add fine payment analytics events #403

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/assets/javascripts/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,31 @@ $(document).on('turbolinks:load', function(){
$('form.contact-form button[type="submit"]').on('click', contactFormSubmission);
$('.request-edit form button[type="submit"]').on('click', changeRequestSubmission);

$('[data-pay-button]').on('click', function(e) {
ga('send', 'event', {
eventCategory: 'Pay fine',
eventAction: 'click to pay',
transport: 'beacon'
});
});

$('body .alert-success:contains("Payment may take up to 5 minutes to appear in your payment history")').each(function(i, val) {
ga('send', 'event', {
eventCategory: 'Pay fine',
eventAction: 'success',
transport: 'beacon'
});
});

$('body .alert-danger:contains("Payment canceled")').each(function(i, val) {
ga('send', 'event', {
eventCategory: 'Pay fine',
eventAction: 'canceled',
transport: 'beacon'
});
});


// Things that may happen in a modal
$('#mylibrary-modal').on('shown.bs.modal', function(e) {
$('form.contact-form button[type="submit"]').on('click', contactFormSubmission);
Expand Down
2 changes: 1 addition & 1 deletion app/views/fines/_pay_all_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if patron_or_group.fines.sum(&:owed).positive? %>
<div>
<% if patron_or_group.can_pay_fines? %>
<%= link_to cybersource_pay_url, class: 'btn btn-md btn-info' do %>
<%= link_to cybersource_pay_url, class: 'btn btn-md btn-info', data: { 'pay-button' => true } do %>
<%= sul_icon :'sharp-payment-24px' %>
<span>Pay <%= number_to_currency(patron_or_group.fines.sum(&:owed)) %> now</span>
<% end %>
Expand Down