Use of Shiny and Google Tag Manager

I am looking for resources showing how to structure shinydashboard code to communicate with Google Tag Manager. Specifically, I need to send a dataLayer (which is a java script array) with some user inputs to Tag Manager, and its Google Analytics page. I haven't found examples of how to do this. This resource really doesn't address my issue:

To be specific, my dashboard has two drop down boxes and a set of check boxed. I want to send used selected values from the drop downs and check boxes when the user clicks on the "profile" button:
#begin Chunk 1
observeEvent(input$profile, { # This is a "View Profile" button
submitPush(input$level,input$unit,input$outChk) # Function call to generate GA message
} # end Chunk 1

and the "submitPush" function:

Begin Chunk 1

submitPush <- function(lvl,unit,topics) {

lvlStr <- paste0("'DataLevel' : '",lvl,"'") # First Dropdown
unitStr <-paste0("'Location' : '",unit,"'") # Second Dropdown

if("stats" %in% topics) { #A series of if statements, one for each checkbox
statsStr <- "'BasicStatistics' : 'yes'"
}else {
statsStr <- "'BasicStatistics' : 'no'"
#assembling script
outstr <-paste0("window.dataLayer.push({",lvlStr,",",unitStr,",",statsStr,",",popfStr,",",
popStr,",",popcStr,",",housingStr,",",commStr,",",emplindStr,",",emplyStr,", 'event':'viewProfile'});")

} #End Chunk 2

This code is not writing the java script chunk for dataLayer in a way that Google Tag Manager can read it.
Any ideas?