Skip to content

Commit

Permalink
Merge branch 'experiments117-remove-donate-button-value-experiment'
Browse files Browse the repository at this point in the history
  • Loading branch information
garethrees committed Nov 6, 2019
2 parents 93339b7 + 917591a commit 08e2ca5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
42 changes: 0 additions & 42 deletions app/assets/javascripts/tests.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,4 @@
function donateButtonTextVariant(variant) {
if (variant === '0') {
$(document).ready(function(){
$('.donate-cta__button').text('Donate now');
});
} else if (variant === '1') {
$(document).ready(function(){
$('.donate-cta__button').text('Donate £5 now');
});
} else if (variant === '2') {
$(document).ready(function(){
$('.donate-cta__button').text('Donate £10 now');
});
}
};

if ( typeof dataLayer === 'object' && typeof gtag === 'undefined' ) {
// https://support.google.com/optimize/answer/9059383
function gtag() { dataLayer.push(arguments); };
}

if ( typeof gtag !== 'undefined' ) {
gtag('event', 'optimize.callback', {
name: 'XinKUWDjTuK7Yxyo3ZBS4g',
callback: donateButtonTextVariant
});
}

$(function(){
// Record an event whenever the donation button is clicked.
$('.donate-cta__button').on('click', function(e){
if( typeof ga !== 'undefined' && ga.loaded ){
e.preventDefault();
var href = $(this).attr('href');
ga('send', {
hitType: 'event',
eventCategory: 'Request page donate button',
eventAction: 'click',
eventLabel: document.title,
hitCallback: function() {
window.location.href = href;
}
});
}
});
});
1 change: 0 additions & 1 deletion lib/views/request/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,4 @@

<%= content_for :javascript do %>
<%= javascript_include_tag 'request-attachments.js' %>
<%= javascript_include_tag 'tests.js' %>
<% end %>

0 comments on commit 08e2ca5

Please sign in to comment.