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

Wrap calls to ga check for analytics_tracking_id #290

Merged
1 commit merged into from
Nov 28, 2024
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
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);
Copy link
Contributor

@hobbitronics hobbitronics Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be

      gtag('event', 'IdP', {
        'event_category': 'hub',
        'event_label': 'choice',
        'value': 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
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 %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like @forevermatt wanting an abstraction to make the sense of these "is not empty" clearer, even though I know what it is.

<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