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

Conversation

jason-jackson
Copy link
Contributor

Changed

  • Wrap calls to ga check for analytics_tracking_id

@jason-jackson jason-jackson requested a review from a team as a code owner November 13, 2024 22:11
@jason-jackson jason-jackson requested review from briskt, forevermatt, mtompset and hobbitronics and removed request for a team November 13, 2024 22:11
Copy link
Contributor

@briskt briskt left a comment

Choose a reason for hiding this comment

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

Great job hunting down all the uses of ga!

@briskt
Copy link
Contributor

briskt commented Nov 14, 2024

I'm surprised ga is not defined since we should be providing the tracking ID in all IdPs. There may be something else wrong with the ga library.

@briskt
Copy link
Contributor

briskt commented Nov 14, 2024

I saw that @forevermatt marked GA as deprecated in idp-id-broker. Maybe he or @devon-sil can comment about its use here.

@jason-jackson
Copy link
Contributor Author

I'm surprised ga is not defined since we should be providing the tracking ID in all IdPs. There may be something else wrong with the ga library.

Good question, maybe the ga commands need to be replaced with gtag commands? I'll look into this tomorrow.

@forevermatt
Copy link
Contributor

I saw that @forevermatt marked GA as deprecated in idp-id-broker. Maybe he or @devon-sil can comment about its use here.

In ID Broker, I was deprecating the use of Google Analytics for reporting MFA metrics (server side, from a cron job). This all looks like client-side reporting, but I don't know if we still use that, either. 🤷

<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.

Copy link
Contributor

@hobbitronics hobbitronics left a comment

Choose a reason for hiding this comment

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

I am finding ga is undefined, but in header.twig gtag is defined and has a slightly different api which looks like:

      gtag('event', 'IdP', {
        'event_category': 'hub',
        'event_label': 'choice',
        'value': id
      });

@@ -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
      });

@hobbitronics hobbitronics closed this pull request by merging all changes into main in 4763b49 Nov 28, 2024
@hobbitronics hobbitronics deleted the feature/handle-missing-ga branch November 28, 2024 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants