Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.
/ diversify Public archive

Commit

Permalink
Fixed double tracking email share
Browse files Browse the repository at this point in the history
  • Loading branch information
Juneezee committed Dec 17, 2019
1 parent f45a3b1 commit 2a147bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/assets/javascripts/landing_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ function track_social(value) {
});
}

$('#email-widget').click(() => {
track_social('Email');
})

// Event listeners for iframe social share button
$(document).ready(() => {
// Sends a function whenever a iframe is focused
window.addEventListener('blur', () => {
if (document.activeElement instanceof HTMLIFrameElement) {
track_social(document.activeElement.dataset.value);
} else if (document.activeElement.id === 'email') {
track_social('Email');
}
});

Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/newsletter.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
%iframe#fb.social.control{allow: 'encrypted-media', allowtransparency: 'true', frameborder: '0', height: '28', scrolling: 'no', src: 'https://www.facebook.com/plugins/share_button.php?href=https%3A%2F%2Fteam07.demo1.genesys.shefcompsci.org.uk&layout=button&size=large&width=77&height=28&appId', style: 'border:none;overflow:hidden', width: '77', 'data-value': 'Facebook'}
%iframe.social#twitter-widget-0.control.twitter-share-button.twitter-share-button-rendered.twitter-tweet-button{allowfullscreen: 'false', allowtransparency: 'true', frameborder: '0', scrolling: 'no', src: 'https://platform.twitter.com/widgets/tweet_button.69e02060c7c44baddf1b5629549acc0c.en.html#dnt=false&id=twitter-widget-0&lang=en&size=l&text=Diversify&type=share&url=https%3A%2F%2Fteam07.demo1.genesys.shefcompsci.org.uk', style: 'position: static; visibility: visible; width: 76px; height: 28px;', 'data-value': 'Twitter'}

%a{href: 'mailto:?subject=I wanted you to see this site&body=Check out this site https://team07.demo1.genesys.shefcompsci.org.uk/.', title: 'Share by Email', id: 'email'}
%a{href: 'mailto:?subject=I wanted you to see this site&body=Check out this site https://team07.demo1.genesys.shefcompsci.org.uk/.', title: 'Share by Email', id: 'email-widget'}
%span.icon.is-large
%span.iconify{'data-icon': 'fxemoji:email'}

Expand Down

0 comments on commit 2a147bc

Please sign in to comment.