distill
distill copied to clipboard
Google analytics on a single distill page?
Question: is it possible to include the google_analytics: 'tracking_id' on a single static distill article? (Generated with rmarkdown::render('name_of_page.Rmd')?
Or is some sort of site rendering necessary?
Ideally, I'd like to be able to add analytics (without manually editing the .html file) without creating an entire site.
This can be done by using includes:
(see https://github.com/rstudio/distill/issues/378)
Create an HTML file with the analytics scripts. I was able to find mine by inspecting an existing page and finding the
-
googletagmanager
script -
google-site-verification
meta line
Pasting that into the filename.html
file and then pointing to it in the YAML did the trick.
Add to YAML:
includes:
in_header: filename.html
Knit file individually.