Skip to content

Commit

Permalink
Add google analytics tags to shiny application
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasmettles committed Jun 11, 2024
1 parent ee148e2 commit 8047613
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions shinydashboard/lantern/google-analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

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

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

2 changes: 2 additions & 0 deletions shinydashboard/lantern/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ ui <- dashboardPage(
"))),
tags$head(tags$link(rel = "shortcut icon", href = "images/favicon.ico")),
tags$head(includeHTML("google-analytics.html")),
tags$noscript(tags$iframe(src="https://www.googletagmanager.com/ns.html?id=GTM-KC3FP96", height="0", width="0", style="display:none;visibility:hidden")),
development_banner(devbanner),
uiOutput("resource_tab_popup"),
h1(textOutput("page_title")),
Expand Down

0 comments on commit 8047613

Please sign in to comment.