Skip to content

Commit

Permalink
fix google analytics and use don't use inline onclick
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbitronics committed Nov 26, 2024
1 parent 8d021d8 commit 81b1ecd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions modules/material/themes/material/default/selectidp-links.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@
idpInput.value = id;
document.querySelector('form').appendChild(idpInput);
ga('send', 'event', 'hub', 'choice', 'IdP', id);
gtag('event', 'IdP', {
'event_category': 'hub',
'event_label': 'choice',
'value': id
});
document.querySelector('form').submit();
}
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('button[data-entityid]').forEach((idp) => {
idp.addEventListener('click', () => {
setSelectedIdp(idp.dataset.entityid);
});
});
});
function clickedAnyway(idpName) {
ga('send', 'event', 'hub', 'choice-disabled', 'IdP', idpName);
Expand Down Expand Up @@ -61,7 +73,7 @@
title="{{ '{selectidp-links:enabled}'|trans({'%idpName%': idp|entityDisplayName}) }}"
>
<div class="mdl-card__media white-bg fixed-height">
<button class="mdl-button logo-container fill-parent" onclick="setSelectedIdp('{{ idp.entityid|e }}')">
<button data-entityid="{{idp.entityid|e}}" type="button" class="mdl-button logo-container fill-parent">
<div class="image-wrapper">
<img
class="logo"
Expand Down

0 comments on commit 81b1ecd

Please sign in to comment.