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 injectable analytics to IG build at runtime. #12

Open
preston opened this issue Apr 7, 2020 · 6 comments
Open

Add injectable analytics to IG build at runtime. #12

preston opened this issue Apr 7, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@preston
Copy link
Contributor

preston commented Apr 7, 2020

For general web assets we have an organizational Google Analytics account. It would be nice to allow for runtime injection of a GA key. We could also do similarly on the server side with logs, but we don't have that infrastructure established yet.

@preston preston added enhancement New feature or request help wanted Extra attention is needed labels Apr 7, 2020
@preston preston changed the title Add injectable analytics. Add injectable analytics to IG build. Apr 7, 2020
@preston preston changed the title Add injectable analytics to IG build. Add injectable analytics to IG build at runtime. Apr 7, 2020
@preston
Copy link
Contributor Author

preston commented Apr 8, 2020

@neuronsong Is this something you could hardcode into a template for now?

@preston preston removed the help wanted Extra attention is needed label Apr 15, 2020
@preston
Copy link
Contributor Author

preston commented Apr 15, 2020

Hey @neuronsong , Laura mentioned you may have been working on this yesterday. Is that true? If not I can take a look as well.

@neuronsong
Copy link
Collaborator

Ah, just seeing this. I turned on basic analytics for logicahealth.org website. There are multiple options to tie in google analytics... but they seem to require a third party account or at least a third party layer. I enabled the most basic of analytics for the time being.

In regard to a template... this should be really simple. Which GA account would you like to use?

@preston
Copy link
Contributor Author

preston commented Apr 15, 2020

The Logica org account with a new tracking ID.

@neuronsong
Copy link
Collaborator

K, np.

I created an account for covid-19-ig... with the following new tag. I'll throw this into the global header of the template and push it in a minute. I think the ig has one and only one global header... but I've been wrong before in regard to the ig code.

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

@neuronsong
Copy link
Collaborator

I hardcoded this into a template for now. Based on the way I had to make this work it will be very easy to inject in the build process. Add a single line to the logica-template/includes/fragment-pagebegin.html file. Then, inject the right code into logica-template/content/assets/js/ga.js file.

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

No branches or pull requests

2 participants