Skip to content

Commit

Permalink
Wrap calls to ga check for analytics_tracking_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-jackson committed Nov 13, 2024
1 parent 3163915 commit 8ac7ae8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 19 deletions.
8 changes: 6 additions & 2 deletions modules/material/themes/material/default/selectidp-links.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
document.querySelector('form').appendChild(idpInput);
ga('send', 'event', 'hub', 'choice', 'IdP', id);
{% if analytics_tracking_id is not empty %}
ga('send', 'event', 'hub', 'choice', 'IdP', id);
{% endif %}
}
function clickedAnyway(idpName) {
ga('send', 'event', 'hub', 'choice-disabled', 'IdP', idpName);
{% if analytics_tracking_id is not empty %}
ga('send', 'event', 'hub', 'choice-disabled', 'IdP', idpName);
{% endif %}
}
</script>
</head>
Expand Down
8 changes: 5 additions & 3 deletions modules/material/themes/material/mfa/new-backup-codes.twig
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@
</div>
</div>

<script>
ga('send', 'event', 'error', 'backupcode', 'generation-failed');
</script>
{% if analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', 'backupcode', 'generation-failed');
</script>
{% endif %}
{% endif %}

<div layout-children="row" class="fill-parent">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
</p>
</div>

<script>
ga('send', 'event', 'error', 'backupcode', '{{ error_message|e('js')|raw }}');
</script>
{% if analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', 'backupcode', '{{ error_message|e('js')|raw }}');
</script>
{% endif %}
{% endif %}

<div class="mdl-card__actions" layout-children="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
</p>
</div>

<script>
ga('send', 'event', 'error', 'managercode', '{{ error_message|e('js')|raw }}');
</script>
{% if analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', 'managercode', '{{ error_message|e('js')|raw }}');
</script>
{% endif %}
{% endif %}

<div class="mdl-card__actions" layout-children="row">
Expand Down
8 changes: 5 additions & 3 deletions modules/material/themes/material/mfa/prompt-for-mfa-totp.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
</p>
</div>

<script>
ga('send', 'event', 'error', 'totp', '{{ error_message|e('js')|raw }}');
</script>
{% if analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', 'totp', '{{ error_message|e('js')|raw }}');
</script>
{% endif %}
{% endif %}

<div class="mdl-card__actions" layout-children="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</p>
</div>

{% if error_message is not empty %}
{% if error_message is not empty and analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', 'webauthn', '{{ error_message|e('js')|raw }}');
</script>
Expand Down
12 changes: 8 additions & 4 deletions modules/material/themes/material/silauth/loginuserpass.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
});
}
ga('send', 'event', 'reCAPTCHA', 'required');
{% if analytics_tracking_id is not empty %}
ga('send', 'event', 'reCAPTCHA', 'required');
{% endif %}
</script>
{% endif %}
</head>
Expand Down Expand Up @@ -100,9 +102,11 @@
</span>
</p>

<script>
ga('send', 'event', 'error', '{{ errorcode|e('js') }}', 'message', '{{ message|e('js') }}');
</script>
{% if analytics_tracking_id is not empty %}
<script>
ga('send', 'event', 'error', '{{ errorcode|e('js') }}', 'message', '{{ message|e('js') }}');
</script>
{% endif %}
{% endif %}

<div class="mdl-card__actions" layout-children="row">
Expand Down

0 comments on commit 8ac7ae8

Please sign in to comment.