| gtm_tags_create | R Documentation |
This takes a tag resource and creates a new tag in GTM.
gtm_tags_create(account_id, container_id, workspace_id, tag_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag_object |
Tag Object |
Other tag functions:
gtm_tags_delete(),
gtm_tags_get(),
gtm_tags_list(),
gtm_tags_revert(),
gtm_tags_update()
## Not run:
accountId <- 1234567
containerId <- 7654321
workspaceId <- 5
# In the Tag Object below you will need to substitute your own trigger Id -
# see \code{gtm_triggers_list} and \code{gtm_triggers_create}
tag <- list(
name = "Example DataLayer Push",
type = "html",
tagFiringOption = "oncePerEvent",
parameter = list(
list(
type = "template",
key = "html",
value = "<script>\n
window.dataLayer=window.dataLayer||[];\n
window.dataLayer.push({\"event\": \"demoEvent\"});\n
</script>"
),
list(
type = "boolean",
key = "supportDocumentWrite",
value = "false"
)
),
firingTriggerId = 20,
tagFiringOption = "oncePerPage"
)
newTag <- gtm_tags_create(accountId, containerId, workspaceId, tag)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.