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

Add ability to include Google analytics scripts in IG pages #256

Open
ElliotSilver opened this issue Oct 31, 2024 · 11 comments
Open

Add ability to include Google analytics scripts in IG pages #256

ElliotSilver opened this issue Oct 31, 2024 · 11 comments
Assignees
Labels
Approved Approved on tooling call enhancement New feature or request

Comments

@ElliotSilver
Copy link
Contributor

To track page views, add following script just after </head> on every page of the IG.

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABCDE12345"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-ABCDE12345');
</script>

G-ABCDE12345 should be replaced by a variable that can be specified in features.yml (?)

@costateixeira
Copy link
Collaborator

if we do this I would just make sure it is conditional to the existence of the google analytics ID, to make sure templates or IGs that don't provide the ID would not have broken javascript

@ElliotSilver
Copy link
Contributor Author

@costateixeira, of course. That would also give people who don't want google tracking to avoid it.

@ElliotSilver
Copy link
Contributor Author

This is a followup to HL7/fhir-ig-publisher#383 which was interpreted to only request a way to specify an ID, not to actually specify and use it.

@grahamegrieve
Copy link
Contributor

This is a template thing, nothing to do with the publisher

@costateixeira
Copy link
Collaborator

Transferring to https://github.com/HL7/ig-template-base, where this belongs

@costateixeira costateixeira transferred this issue from HL7/fhir-ig-publisher Oct 31, 2024
@lmckenzi lmckenzi added enhancement New feature or request Approved Approved on tooling call labels Nov 5, 2024
@lmckenzi lmckenzi moved this from Inbox to To do in IG Publisher issue board Nov 5, 2024
@lmckenzi lmckenzi self-assigned this Nov 5, 2024
@ElliotSilver
Copy link
Contributor Author

I believe this works, in part, by putting a cookie on the client machine to track which pages that particular client navigates to. I think the google script includes an ability to integrate with a (perhaps third party) consent banner, so this shouldn't be a problem for people who need to worry about cookie consent. Use of the google tag is also an opt-in capability on the IG author's part, so this really shouldn't be an issue for authors who are concerned. However, @lmckenzi, you may want to confirm behaviour is acceptable to HL7 before making it the default for HL7 IGs.

@ElliotSilver
Copy link
Contributor Author

We may also want to make it easy to replace the entire script with something more complex in a derived template. (I notice my website uses a modified script to filter out page views by the site admin, etc.).

@costateixeira
Copy link
Collaborator

costateixeira commented Nov 9, 2024 via email

@ElliotSilver
Copy link
Contributor Author

As far as I can tell, you can use Google analytics without consent, or integrate with consent management in several ways.
consent

Because this feature needs to be enabled, they will need to take action for cookies to be collected.

The reason it makes sense to be able to override the script, is to support more complex cases, like I mentioned above -- don't collect if I'm logged in as an admin user. However. I don't know how this works with our rules for active content in our templates.

@costateixeira
Copy link
Collaborator

@lmckenzi
Copy link
Contributor

Also clean up the existing comments so they don't mislead people about how this should be done going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Approved on tooling call enhancement New feature or request
Projects
Development

No branches or pull requests

4 participants