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 Google Tag Manager code to vignettes #302

Closed
celiot-IDM opened this issue Jun 22, 2024 · 2 comments · Fixed by #304
Closed

Add Google Tag Manager code to vignettes #302

celiot-IDM opened this issue Jun 22, 2024 · 2 comments · Fixed by #304
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@celiot-IDM
Copy link
Collaborator

celiot-IDM commented Jun 22, 2024

Per @JSchripsema-IDM :

  1. Paste this code as high in the <head> of the page as possible:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'[https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f)](https://www.googletagmanager.com/gtm.js?id=%27+i+dl;f.parentNode.insertBefore(j,f));
})(window,document,'script','dataLayer','GTM-NK4K647');</script>
<!-- End Google Tag Manager -->

  1. Paste this code immediately after the opening <body> tag:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NK4K647"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

@celiot-IDM celiot-IDM self-assigned this Jun 22, 2024
@celiot-IDM celiot-IDM added the documentation Improvements or additions to documentation label Jun 22, 2024
@celiot-IDM
Copy link
Collaborator Author

celiot-IDM commented Jun 22, 2024

@MeWu-IDM : Please have a look at file .github/vignette-post-build.R in the charles/google-tag branch. (dce4bd0) It should be called from the pacehrh working directory after vignettes are built with the command line Rscript ../.github/vignette-post-build.R

@celiot-IDM
Copy link
Collaborator Author

Note: this is a simplistic implementation: it doesn't check whether the file already has a Google Tag, and will happily add a second one. A better implementation would check for the presence of an existing tag.

@MeWu-IDM MeWu-IDM linked a pull request Jun 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants