Title: | Access the 'Google Tag Manager' API using R |
---|---|
Description: | Interact with the 'Google Tag Manager' API <https://developers.google.com/tag-platform/tag-manager/api/v2>, enabling scripted deployments and updates across multiple tags, triggers, variables and containers. |
Authors: | James Cottrill [aut, cre, cph], Mark Edmondson [ctb], Manos Parzakonis [ctb] |
Maintainer: | James Cottrill <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-12-01 08:11:07 UTC |
Source: | CRAN |
This returns a list containing the metadata about a single account.
If you want to get the information for all accounts, use gtm_accounts_list
gtm_accounts_get(account_id)
gtm_accounts_get(account_id)
account_id |
Account Id |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/get
Other account functions:
gtm_accounts_list()
,
gtm_accounts_update()
## Not run: account_id <- 12345678 account <- gtm_accounts_get(account_id) ## End(Not run)
## Not run: account_id <- 12345678 account <- gtm_accounts_get(account_id) ## End(Not run)
This will return a data frame all your available accounts, returning the path, account Id and account name.
gtm_accounts_list()
gtm_accounts_list()
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/list
Other account functions:
gtm_accounts_get()
,
gtm_accounts_update()
## Not run: accounts <- gtm_accounts_list() ## End(Not run)
## Not run: accounts <- gtm_accounts_list() ## End(Not run)
This enables you to update the account metadata. You can update the account name and whether or not data is shared with Google.
gtm_accounts_update(account_id, name = NULL, shareData = c("TRUE", "FALSE"))
gtm_accounts_update(account_id, name = NULL, shareData = c("TRUE", "FALSE"))
account_id |
Account Id |
name |
Account Display Name |
shareData |
Whether the account shares data anonymously with Google and others. This flag enables benchmarking by sharing your data in an anonymous form. Google will remove all identifiable information about your website, combine the data with hundreds of other anonymous sites and report aggregate trends in the benchmarking service. |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/update
Other account functions:
gtm_accounts_get()
,
gtm_accounts_list()
## Not run: account_id <- 12345678 new_account <- gtm_accounts_update(account_id, name = "New Container Name") ## End(Not run)
## Not run: account_id <- 12345678 new_account <- gtm_accounts_update(account_id, name = "New Container Name") ## End(Not run)
This function authenticates the user with Google Tag Manager To use your own GTM API credentials, either ensure that you have set the path to your OAuth2 API Credentials file in your 'GAR_CLIENT_JSON' variable in your .Renviron file and then restart your R session or set
gtm_auth(email = NULL, token = NULL, sa_json = NULL)
gtm_auth(email = NULL, token = NULL, sa_json = NULL)
email |
The email address for the Google Account |
token |
An existing Google Auth Token |
sa_json |
A GCP Service Account Key in JSON format, either a string or file. |
Invisibly, the token that has been saved to the session
## Not run: # To use the included (shared) credentials library(googleTagManageR) gtm_auth() # To useyour own GCP credentials Sys.setenv("GAR_CLIENT_JSON" = "location/of/file.json") library(googleTagManageR) gtm_auth() # Reauthentication - if you've already logged in gtm_auth(email="[email protected]") # Service Account Login gtm_auth(sa_json="my-service-account.json") ## End(Not run)
## Not run: # To use the included (shared) credentials library(googleTagManageR) gtm_auth() # To useyour own GCP credentials Sys.setenv("GAR_CLIENT_JSON" = "location/of/file.json") library(googleTagManageR) gtm_auth() # Reauthentication - if you've already logged in gtm_auth(email="[email protected]") # Service Account Login gtm_auth(sa_json="my-service-account.json") ## End(Not run)
This enables one of the built-in variables in GTM. It is the inverse of gtm_builtin_delete
gtm_builtin_create(account_id, container_id, workspace_id, variable)
gtm_builtin_create(account_id, container_id, workspace_id, variable)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable |
A Builtin Variable or list of built in variables. Valid values are here |
Other built in variable functions:
gtm_builtin_delete()
,
gtm_builtin_list()
,
gtm_builtin_revert()
,
variables_list
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' builtinVaribles<- gtm_builtin_create(accountId, containerId, workspaceId, variable) listOfVaribales <- c('clickClasses', 'clickElement') newEnabledVars <- gtm_builtin_create(accountId, containerId, workspaceId, listOfVaribales) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' builtinVaribles<- gtm_builtin_create(accountId, containerId, workspaceId, variable) listOfVaribales <- c('clickClasses', 'clickElement') newEnabledVars <- gtm_builtin_create(accountId, containerId, workspaceId, listOfVaribales) ## End(Not run)
This disables one or more of the built-in variables in GTM. It is the inverse of gtm_builtin_create
gtm_builtin_delete(account_id, container_id, workspace_id, variable)
gtm_builtin_delete(account_id, container_id, workspace_id, variable)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable |
A built-in Variable or list of built-in variables. Valid values are here |
Other built in variable functions:
gtm_builtin_create()
,
gtm_builtin_list()
,
gtm_builtin_revert()
,
variables_list
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' builtinVaribles<- gtm_builtin_delete(accountId, containerId, workspaceId, variable) listOfVaribales <- c('clickClasses', 'clickElement') newEnabledVars <- gtm_builtin_delete(accountId, containerId, workspaceId, listOfVaribales) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' builtinVaribles<- gtm_builtin_delete(accountId, containerId, workspaceId, variable) listOfVaribales <- c('clickClasses', 'clickElement') newEnabledVars <- gtm_builtin_delete(accountId, containerId, workspaceId, listOfVaribales) ## End(Not run)
This will return a data frame all enabled built-in variables in a given workspace
gtm_builtin_list(account_id, container_id, workspace_id)
gtm_builtin_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other built in variable functions:
gtm_builtin_create()
,
gtm_builtin_delete()
,
gtm_builtin_revert()
,
variables_list
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 builtinVaribles<- gtm_builtin_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 builtinVaribles<- gtm_builtin_list(accountId, containerId, workspaceId) ## End(Not run)
This reeverts any changes to a GTM Built-In Variables in a GTM Workspace.
gtm_builtin_revert(account_id, container_id, workspace_id, variable)
gtm_builtin_revert(account_id, container_id, workspace_id, variable)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable |
A built-in Variable or list of built-in variables. Valid values are here |
Other built in variable functions:
gtm_builtin_create()
,
gtm_builtin_delete()
,
gtm_builtin_list()
,
variables_list
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' variable <- gtm_variables_revert(accountId, containerId, workspaceId, variable) # Changes to variable 22 have been reverted ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variable <- 'clickId' variable <- gtm_variables_revert(accountId, containerId, workspaceId, variable) # Changes to variable 22 have been reverted ## End(Not run)
This creates a new container in the specified account.
gtm_containers_create( account_id, name, type = c("web", "iosSdk5", "androidSdk5", "amp", "server"), domain_name = NULL, notes = NULL )
gtm_containers_create( account_id, name, type = c("web", "iosSdk5", "androidSdk5", "amp", "server"), domain_name = NULL, notes = NULL )
account_id |
Account Id |
name |
Container Name |
type |
Container Use Type, one of web, iosSdk5, androidSdk5, amp or server |
domain_name |
List of domain names associated with the Container. |
notes |
Container Notes. |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/create
Other container functions:
gtm_containers_delete()
,
gtm_containers_get()
,
gtm_containers_list()
,
gtm_containers_update()
## Not run: accountId <- 1234567 newName <- "My New Container" container <- gtm_containers_create(accountId, newName, 'web') ## End(Not run)
## Not run: accountId <- 1234567 newName <- "My New Container" container <- gtm_containers_create(accountId, newName, 'web') ## End(Not run)
This deletes a GTM container from an account. This is an irreversible process, so it's recommended that you first back up the container.
gtm_containers_delete(account_id, container_id, force = c("TRUE", "FALSE"))
gtm_containers_delete(account_id, container_id, force = c("TRUE", "FALSE"))
account_id |
Account Id |
container_id |
Container Id |
force |
Force deletion without user input |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/delete
Other container functions:
gtm_containers_create()
,
gtm_containers_get()
,
gtm_containers_list()
,
gtm_containers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 gtm_conainers_delete(accountId, containerId, "TRUE") containerId <- 7654567 gtm_containers_delete(accountId, containerId) # !!WARNING!! This command will delete your container. # This operation is irrevocable. # It is strongly recommended that you create an export of your container # before you delete it, just in case you ever want it again. # Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Are You really sure you want to delete this container? # 1: Yes # 2: No # Selection: 1 # Container 7654567 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 gtm_conainers_delete(accountId, containerId, "TRUE") containerId <- 7654567 gtm_containers_delete(accountId, containerId) # !!WARNING!! This command will delete your container. # This operation is irrevocable. # It is strongly recommended that you create an export of your container # before you delete it, just in case you ever want it again. # Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Are You really sure you want to delete this container? # 1: Yes # 2: No # Selection: 1 # Container 7654567 has been deleted. ## End(Not run)
This returns a list containing all the metadata about a single container.
If you want to get the information for all containers, use gtm_containers_list
gtm_containers_get(account_id, container_id)
gtm_containers_get(account_id, container_id)
account_id |
Account Id |
container_id |
Container Id |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/get
Other container functions:
gtm_containers_create()
,
gtm_containers_delete()
,
gtm_containers_list()
,
gtm_containers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 container <- gtm_containers_get(accountId, containerId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 container <- gtm_containers_get(accountId, containerId) ## End(Not run)
This returns a dataframe containing all the containers in an account
If you want to get the information for a single container, use gtm_containers_get
gtm_containers_list(account_id)
gtm_containers_list(account_id)
account_id |
Account Id |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/list
Other container functions:
gtm_containers_create()
,
gtm_containers_delete()
,
gtm_containers_get()
,
gtm_containers_update()
## Not run: accounts <- gtm_accounts_list() containers <- gtm_containers_list(accounts$accountId[1]) ## End(Not run)
## Not run: accounts <- gtm_accounts_list() containers <- gtm_containers_list(accounts$accountId[1]) ## End(Not run)
This updates a GTM Container. Although you can't change the type of container, it is still required for this function to work.
gtm_containers_update( account_id, container_id, name, type = c("amp", "androidSdk5", "iosSdk5", "web", "server"), domain_name = "", notes = "" )
gtm_containers_update( account_id, container_id, name, type = c("amp", "androidSdk5", "iosSdk5", "web", "server"), domain_name = "", notes = "" )
account_id |
Account Id |
container_id |
Container Id |
name |
Container Name |
type |
Container Use Type, one of web, iosSdk5, androidSdk5, amp or server |
domain_name |
List of domain names associated with the Container. |
notes |
Container Notes. |
https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/update
Other container functions:
gtm_containers_create()
,
gtm_containers_delete()
,
gtm_containers_get()
,
gtm_containers_list()
## Not run: accountId <- 1234567 containerId <- 7654321 containers <- gtm_containers_update(accountId, containerId, 'New Container Name', 'amp') ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 containers <- gtm_containers_update(accountId, containerId, 'New Container Name', 'amp') ## End(Not run)
This creates a new GTM environment
gtm_environments_create( account_id, container_id, name, description = NULL, debug = c("TRUE", "FALSE"), url = NULL )
gtm_environments_create( account_id, container_id, name, description = NULL, debug = c("TRUE", "FALSE"), url = NULL )
account_id |
Account Id |
container_id |
Container Id |
name |
The environment display name. Can be set or changed only on USER type environments. |
description |
The environment description. Can be set or changed only on USER type environments. |
debug |
Whether or not to enable debug by default for the environment. |
url |
Default preview page url for the environment. |
Other environment functions:
gtm_environments_delete()
,
gtm_environments_get()
,
gtm_environments_list()
,
gtm_environments_reauthorize()
,
gtm_environments_update()
## Not run: accountId <- 1234567 containerId <- 7654321 env <- gtm_environments_create(accountId, containerId, "Development") pp_env <- gtm_environments_create(accountId, containerId, "Pre-Prod", debug=TRUE, url="https://pp.example.com") ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 env <- gtm_environments_create(accountId, containerId, "Development") pp_env <- gtm_environments_create(accountId, containerId, "Pre-Prod", debug=TRUE, url="https://pp.example.com") ## End(Not run)
This deletes a GTM environment
gtm_environments_delete( account_id, container_id, environment_id, force = c("TRUE", "FALSE") )
gtm_environments_delete( account_id, container_id, environment_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
environment_id |
Environment Id |
force |
This will bypass the user confirmation. Useful for scripted functions to avoid user input |
Other environment functions:
gtm_environments_create()
,
gtm_environments_get()
,
gtm_environments_list()
,
gtm_environments_reauthorize()
,
gtm_environments_update()
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 3 gtm_environments_delete(accountId, containerId, environmentId, TRUE) environmentId <- 4 gtm_environments_delete(accountId, containerId, environmentId) # This will delete environment 4 Are you sure you want to continue?" # 1: Yes # 2: No # Selection: 1 # Environment 4 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 3 gtm_environments_delete(accountId, containerId, environmentId, TRUE) environmentId <- 4 gtm_environments_delete(accountId, containerId, environmentId) # This will delete environment 4 Are you sure you want to continue?" # 1: Yes # 2: No # Selection: 1 # Environment 4 has been deleted. ## End(Not run)
This gets the metadata for a single GTM Environment
gtm_environments_get(account_id, container_id, environment_id)
gtm_environments_get(account_id, container_id, environment_id)
account_id |
Account Id |
container_id |
Container Id |
environment_id |
Environment Id |
Other environment functions:
gtm_environments_create()
,
gtm_environments_delete()
,
gtm_environments_list()
,
gtm_environments_reauthorize()
,
gtm_environments_update()
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 3 environmnet <- gtm_environments_get(accountId, containerId, environmentId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 3 environmnet <- gtm_environments_get(accountId, containerId, environmentId) ## End(Not run)
This lists the environments in a specified container.
gtm_environments_list(account_id, container_id)
gtm_environments_list(account_id, container_id)
account_id |
Account Id |
container_id |
Container Id |
Other environment functions:
gtm_environments_create()
,
gtm_environments_delete()
,
gtm_environments_get()
,
gtm_environments_reauthorize()
,
gtm_environments_update()
## Not run: accountId <- 1234567 containerId <- 7654321 environments <- gtm_environments_list(accountId, containerId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 environments <- gtm_environments_list(accountId, containerId) ## End(Not run)
This reauthorises an existing GTM environment, generating a new authrorisation Id. This is used to invalidate any existing preview GTM shared preview links and any installations of the environment. You will need to update any snippets on your site with the new authorisation Id afterwards.
gtm_environments_reauthorize( account_id, container_id, environment_id, environment )
gtm_environments_reauthorize( account_id, container_id, environment_id, environment )
account_id |
Account Id |
container_id |
Container Id |
environment_id |
Environment Id |
environment |
An Environment object - If you don't have one, one will be generated for you. |
Other environment functions:
gtm_environments_create()
,
gtm_environments_delete()
,
gtm_environments_get()
,
gtm_environments_list()
,
gtm_environments_update()
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 4 env <- gtm_environments_reauthorize(accountId, containerId, enviromentId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 environmentId <- 4 env <- gtm_environments_reauthorize(accountId, containerId, enviromentId) ## End(Not run)
This updates a GTM environment
gtm_environments_update( account_id, container_id, environment_id, name, description = NULL, debug = c("TRUE", "FALSE"), url = NULL )
gtm_environments_update( account_id, container_id, environment_id, name, description = NULL, debug = c("TRUE", "FALSE"), url = NULL )
account_id |
Account Id |
container_id |
Container Id |
environment_id |
Environment Id |
name |
The environment display name. Can be set or changed only on USER type environments. |
description |
The environment description. Can be set or changed only on USER type environments. |
debug |
Whether or not to enable debug by default for the environment. |
url |
Default preview page url for the environment. |
Other environment functions:
gtm_environments_create()
,
gtm_environments_delete()
,
gtm_environments_get()
,
gtm_environments_list()
,
gtm_environments_reauthorize()
## Not run: accountId <- 1234567 containerId <- 7654321 gtm_environments_update(accountId, containerId, "Pre-Prod", url="https://new-pp.example.com") ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 gtm_environments_update(accountId, containerId, "Pre-Prod", url="https://new-pp.example.com") ## End(Not run)
This creates a new folder in the specified workspaces
gtm_folders_create(account_id, container_id, workspace_id, name, notes = NULL)
gtm_folders_create(account_id, container_id, workspace_id, name, notes = NULL)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
name |
Folder display name |
notes |
User notes on how to apply this folder in the container. |
Other folder functions:
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderName <- "Analytics Tags" folderNotes <- "All our website's Google Analytics Tags" folder <- gtm_folders_create(accountId, containerId, workspaceId, folderName, folderNotes) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderName <- "Analytics Tags" folderNotes <- "All our website's Google Analytics Tags" folder <- gtm_folders_create(accountId, containerId, workspaceId, folderName, folderNotes) ## End(Not run)
This deletes a folder in the specified workspaces
gtm_folders_delete( account_id, container_id, workspace_id, folder_id, force = c("TRUE", "FALSE") )
gtm_folders_delete( account_id, container_id, workspace_id, folder_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
force |
Force deletion without user input |
Other folder functions:
gtm_folders_create()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 gtm_folders_delete(accountId, containerId, workspaceId, force=TRUE) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 gtm_folders_delete(accountId, containerId, workspaceId, force=TRUE) ## End(Not run)
This lists all entities in a GTM Folder.
gtm_folders_entities(account_id, container_id, workspace_id, folder_id)
gtm_folders_entities(account_id, container_id, workspace_id, folder_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_entities(accountId, containerId, workspaceId, folderId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_entities(accountId, containerId, workspaceId, folderId) ## End(Not run)
This returns a list containing all the metadata for a single folder in a workspace
If you want to get the information for all folders, use gtm_folders_list
gtm_folders_get(account_id, container_id, workspace_id, folder_id)
gtm_folders_get(account_id, container_id, workspace_id, folder_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_list(accountId, containerId, workspaceId, folderId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_list(accountId, containerId, workspaceId, folderId) ## End(Not run)
This returns a dataframe containing all the folder in a workspace
If you want to get the information for a single folder, use gtm_folders_get
gtm_folders_list(account_id, container_id, workspace_id)
gtm_folders_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_move()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folders <- gtm_folders_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folders <- gtm_folders_list(accountId, containerId, workspaceId) ## End(Not run)
This moves entities to a new folder.
gtm_folders_move( account_id, container_id, workspace_id, folder_id, tags = NULL, triggers = NULL, variables = NULL )
gtm_folders_move( account_id, container_id, workspace_id, folder_id, tags = NULL, triggers = NULL, variables = NULL )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
tags |
The tags to be moved to the folder. This can either be an individual tag Id or a list of tag Ids |
triggers |
The triggers to be moved to the folder. This can either be an individual trigger Id or a list of trigger Ids |
variables |
The variables to be moved to the folder. This can either be an individual variable Id or a list of variable Ids |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_revert()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 tags = 12 gtm_folders_move(accountId, containerId, workspaceId, folderId, tags = tags) triggers = c(1,2,3) tags = c(4,5,6) gtm_folders_move(accountId, containerId, workspaceId, folderId, tags = tags) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 tags = 12 gtm_folders_move(accountId, containerId, workspaceId, folderId, tags = tags) triggers = c(1,2,3) tags = c(4,5,6) gtm_folders_move(accountId, containerId, workspaceId, folderId, tags = tags) ## End(Not run)
This reverts any changes to a folder in the current workspace
gtm_folders_revert(account_id, container_id, workspace_id, folder_id)
gtm_folders_revert(account_id, container_id, workspace_id, folder_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_revert(accountId, containerId, workspaceId, folderId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderId <- 1 folder <- gtm_folders_revert(accountId, containerId, workspaceId, folderId) ## End(Not run)
This updates a folder in the specified workspaces
gtm_folders_update( account_id, container_id, workspace_id, folder_id, name = NULL, notes = NULL )
gtm_folders_update( account_id, container_id, workspace_id, folder_id, name = NULL, notes = NULL )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
folder_id |
Folder Id |
name |
Folder display name |
notes |
User notes on how to apply this folder in the container. |
Other folder functions:
gtm_folders_create()
,
gtm_folders_delete()
,
gtm_folders_entities()
,
gtm_folders_get()
,
gtm_folders_list()
,
gtm_folders_move()
,
gtm_folders_revert()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderName <- "New Analytics Tags" folderNotes <- "All our website's Google Analytics App+Web Tags" folder <- gtm_folders_update(accountId, containerId, workspaceId, folderName, folderNotes) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 folderName <- "New Analytics Tags" folderNotes <- "All our website's Google Analytics App+Web Tags" folder <- gtm_folders_update(accountId, containerId, workspaceId, folderName, folderNotes) ## End(Not run)
This will return the latest container version header
If you want to get the information for the most all container versions, use gtm_headers_list
gtm_headers_latest(account_id, container_id)
gtm_headers_latest(account_id, container_id)
account_id |
Account Id |
container_id |
Container Id |
Other version header functions:
gtm_headers_list()
## Not run: accountId <- 1234567 containerId <- 7654321 latestHeader <- gtm_headers_latest(accountId, containerId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 latestHeader <- gtm_headers_latest(accountId, containerId) ## End(Not run)
This will return a data frame all container versions.
If you want to get the information for the most recent version, use gtm_headers_latest
gtm_headers_list(account_id, container_id, includeDeleted = c("TRUE", "FALSE"))
gtm_headers_list(account_id, container_id, includeDeleted = c("TRUE", "FALSE"))
account_id |
Account Id |
container_id |
Container Id |
includeDeleted |
Include deleted version - Default False |
Other version header functions:
gtm_headers_latest()
## Not run: accountId <- 1234567 containerId <- 7654321 headers <- gtm_headers_list(accountId, containerId) headersWithDeleted <- gtm_headers_list(accountId, containerId, 'TRUE') ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 headers <- gtm_headers_list(accountId, containerId) headersWithDeleted <- gtm_headers_list(accountId, containerId, 'TRUE') ## End(Not run)
This takes a tag resource and creates a new tag in GTM.
gtm_tags_create(account_id, container_id, workspace_id, tag_object)
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)
## 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)
This deletes a tag in a GTM workspace
gtm_tags_delete( account_id, container_id, workspace_id, tag_id, force = c("TRUE", "FALSE") )
gtm_tags_delete( account_id, container_id, workspace_id, tag_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag_id |
Tag Id |
force |
Force deletion without user input |
Other tag functions:
gtm_tags_create()
,
gtm_tags_get()
,
gtm_tags_list()
,
gtm_tags_revert()
,
gtm_tags_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId <- 100 gtm_tags_delete(accountId, containerId, workspaceId, tagId) # This will delete tag %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Tag 100 has been deleted. tagId = 101 gtm_tags_delete(accountId, containerId, workspaceId, tagId, "TRUE") # Tag 101 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId <- 100 gtm_tags_delete(accountId, containerId, workspaceId, tagId) # This will delete tag %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Tag 100 has been deleted. tagId = 101 gtm_tags_delete(accountId, containerId, workspaceId, tagId, "TRUE") # Tag 101 has been deleted. ## End(Not run)
This will return a list with the settings of a single tag.
If you want to get the information for all tags, use gtm_tags_list
gtm_tags_get(account_id, container_id, workspace_id, tag_id)
gtm_tags_get(account_id, container_id, workspace_id, tag_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag_id |
Tag Id |
Other tag functions:
gtm_tags_create()
,
gtm_tags_delete()
,
gtm_tags_list()
,
gtm_tags_revert()
,
gtm_tags_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId = 100 tag <- gtm_tags_get(accountId, containerId, workspaceId, tagId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId = 100 tag <- gtm_tags_get(accountId, containerId, workspaceId, tagId) ## End(Not run)
This will return a data frame all your available tags in a given workspace
If you want to get the information for a single tag, use gtm_tags_get
gtm_tags_list(account_id, container_id, workspace_id)
gtm_tags_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other tag functions:
gtm_tags_create()
,
gtm_tags_delete()
,
gtm_tags_get()
,
gtm_tags_revert()
,
gtm_tags_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tags <- gtm_tags_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tags <- gtm_tags_list(accountId, containerId, workspaceId) ## End(Not run)
This reverts a tag back to its original, unmodified state.
gtm_tags_revert(account_id, container_id, workspace_id, tag_id)
gtm_tags_revert(account_id, container_id, workspace_id, tag_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag_id |
Tag Id |
Other tag functions:
gtm_tags_create()
,
gtm_tags_delete()
,
gtm_tags_get()
,
gtm_tags_list()
,
gtm_tags_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId <- 102 tag <- gtm_tags_revert(accountId, containerId, workspaceId, tagId) # Changes to tag 102 have been reverted ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 tagId <- 102 tag <- gtm_tags_revert(accountId, containerId, workspaceId, tagId) # Changes to tag 102 have been reverted ## End(Not run)
This takes a tag resource and overwrites the existing tag in GTM
gtm_tags_update(account_id, container_id, workspace_id, tag_id, tag_object)
gtm_tags_update(account_id, container_id, workspace_id, tag_id, tag_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag_id |
Tag Id |
tag_object |
Tag Object |
Other tag functions:
gtm_tags_create()
,
gtm_tags_delete()
,
gtm_tags_get()
,
gtm_tags_list()
,
gtm_tags_revert()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 tagId <- 11 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" ) updatedTag <- gtm_tags_update(accountId, containerId, workspaceId, tagId, tag) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 tagId <- 11 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" ) updatedTag <- gtm_tags_update(accountId, containerId, workspaceId, tagId, tag) ## End(Not run)
This takes a trigger resource and creates a new trigger in GTM.
gtm_triggers_create(account_id, container_id, workspace_id, trigger_object)
gtm_triggers_create(account_id, container_id, workspace_id, trigger_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
trigger_object |
Trigger Object |
Other trigger functions:
gtm_triggers_delete()
,
gtm_triggers_get()
,
gtm_triggers_list()
,
gtm_triggers_revert()
,
gtm_triggers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 trigger <- list( name = 'Demo Trigger', type = 'pageview' ) newTrigger <- gtm_triggers_create(accountId, containerId, workspaceId, trigger) trigger2 <- list( name = 'More Complex Trigger', type = 'pageview', filter = list( list( type = 'contains', parameter = list( list( type='template', key = 'arg0', value='{{Lookup Table}}' ), list( type='template', key = 'arg1', value='Lookup Value' ) ) ) ) ) newTrigger2 <- gtm_triggers_create(accountId, containerId, workspaceId, trigger2) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 trigger <- list( name = 'Demo Trigger', type = 'pageview' ) newTrigger <- gtm_triggers_create(accountId, containerId, workspaceId, trigger) trigger2 <- list( name = 'More Complex Trigger', type = 'pageview', filter = list( list( type = 'contains', parameter = list( list( type='template', key = 'arg0', value='{{Lookup Table}}' ), list( type='template', key = 'arg1', value='Lookup Value' ) ) ) ) ) newTrigger2 <- gtm_triggers_create(accountId, containerId, workspaceId, trigger2) ## End(Not run)
This deletes a trigger in a GTM workspace
gtm_triggers_delete( account_id, container_id, workspace_id, trigger_id, force = c(TRUE, FALSE) )
gtm_triggers_delete( account_id, container_id, workspace_id, trigger_id, force = c(TRUE, FALSE) )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
trigger_id |
trigger Id |
force |
Force deletion without user input |
Other trigger functions:
gtm_triggers_create()
,
gtm_triggers_get()
,
gtm_triggers_list()
,
gtm_triggers_revert()
,
gtm_triggers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 triggerId <- 13 gtm_triggers_delete(accountId, containerId, workspaceId, triggerId) # This will delete trigger %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # trigger 13 has been deleted. triggerId = 14 gtm_triggers_delete(accountId, containerId, workspaceId, triggerId, "TRUE") # Trigger 14 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 triggerId <- 13 gtm_triggers_delete(accountId, containerId, workspaceId, triggerId) # This will delete trigger %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # trigger 13 has been deleted. triggerId = 14 gtm_triggers_delete(accountId, containerId, workspaceId, triggerId, "TRUE") # Trigger 14 has been deleted. ## End(Not run)
This will return a list with the settings of a single trigger.
If you want to get the information for all triggers, use gtm_triggers_list
gtm_triggers_get(account_id, container_id, workspace_id, trigger_id)
gtm_triggers_get(account_id, container_id, workspace_id, trigger_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
trigger_id |
trigger Id |
Other trigger functions:
gtm_triggers_create()
,
gtm_triggers_delete()
,
gtm_triggers_list()
,
gtm_triggers_revert()
,
gtm_triggers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggerID <- 12 trigger <- gtm_triggers_get(accountId, containerId, workspaceId, triggerId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggerID <- 12 trigger <- gtm_triggers_get(accountId, containerId, workspaceId, triggerId) ## End(Not run)
This will return a data frame all your available triggers in a given workspace
If you want to get the information for a single trigger, use gtm_triggers_get
gtm_triggers_list(account_id, container_id, workspace_id)
gtm_triggers_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other trigger functions:
gtm_triggers_create()
,
gtm_triggers_delete()
,
gtm_triggers_get()
,
gtm_triggers_revert()
,
gtm_triggers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggers <- gtm_triggers_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggers <- gtm_triggers_list(accountId, containerId, workspaceId) ## End(Not run)
This reverts a trigger back to its original, unmodified state.
gtm_triggers_revert(account_id, container_id, workspace_id, trigger_id)
gtm_triggers_revert(account_id, container_id, workspace_id, trigger_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
trigger_id |
Trigger Id |
Other trigger functions:
gtm_triggers_create()
,
gtm_triggers_delete()
,
gtm_triggers_get()
,
gtm_triggers_list()
,
gtm_triggers_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 triggerId <- 20 trugger <- gtm_triggers_revert(accountId, containerId, workspaceId, triggerId) # Changes to trigger 20 have been reverted ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 triggerId <- 20 trugger <- gtm_triggers_revert(accountId, containerId, workspaceId, triggerId) # Changes to trigger 20 have been reverted ## End(Not run)
This takes a trigger resource and overwrites the existing trigger in GTM
gtm_triggers_update( account_id, container_id, workspace_id, trigger_id, trigger_object )
gtm_triggers_update( account_id, container_id, workspace_id, trigger_id, trigger_object )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
trigger_id |
trigger Id |
trigger_object |
trigger Object |
Other trigger functions:
gtm_triggers_create()
,
gtm_triggers_delete()
,
gtm_triggers_get()
,
gtm_triggers_list()
,
gtm_triggers_revert()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggerId <- 8 updatedTrigger <- list( name = 'More Complex Trigger - Updated', type = 'pageview', filter = list( list( type = 'contains', parameter = list( list( type='template', key = 'arg0', value='{{Lookup Table}}' ), list( type='template', key = 'arg1', value='New Lookup Value' ) ) ) ) ) newTrigger2 <- gtm_triggers_update(accountId, containerId, workspaceId, triggerId, updatedTrigger) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 triggerId <- 8 updatedTrigger <- list( name = 'More Complex Trigger - Updated', type = 'pageview', filter = list( list( type = 'contains', parameter = list( list( type='template', key = 'arg0', value='{{Lookup Table}}' ), list( type='template', key = 'arg1', value='New Lookup Value' ) ) ) ) ) newTrigger2 <- gtm_triggers_update(accountId, containerId, workspaceId, triggerId, updatedTrigger) ## End(Not run)
This takes a variable resource and creates a new variable in GTM.
gtm_variables_create(account_id, container_id, workspace_id, variable_object)
gtm_variables_create(account_id, container_id, workspace_id, variable_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable_object |
Variable Object |
Other variable functions:
gtm_variables_delete()
,
gtm_variables_get()
,
gtm_variables_list()
,
gtm_variables_revert()
,
gtm_variables_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 variable <- list( name = 'Custom JS Variable', type = 'jsm', parameter = list( list( type = 'template', key = 'javascript', value = 'function(){\n return document.querySelector(\"form\").id;\n}' ) ) ) cjsVariable <- gtm_variables_create(accountId, containerId, workspaceId, variable) variable2 <- list( name = 'Lookup Table', type = 'smm', parameter = list( list( type = 'boolean', key = 'setDefaultValue', value = 'false' ), list( type = 'template', key = 'input', value = '{{Page Hostname}}' ), list( type = 'list', key = 'map', list = list( list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'google.co.uk' ), list( type = 'template', key = 'value', value = 'UA-123456-1' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'bing.com' ), list( type = 'template', key = 'value', value = 'UA-123456-2' ) ) ) ) ) ) ) lookupTable <- gtm_variables_create(accountId, containerId, workspaceId, variable2) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 variable <- list( name = 'Custom JS Variable', type = 'jsm', parameter = list( list( type = 'template', key = 'javascript', value = 'function(){\n return document.querySelector(\"form\").id;\n}' ) ) ) cjsVariable <- gtm_variables_create(accountId, containerId, workspaceId, variable) variable2 <- list( name = 'Lookup Table', type = 'smm', parameter = list( list( type = 'boolean', key = 'setDefaultValue', value = 'false' ), list( type = 'template', key = 'input', value = '{{Page Hostname}}' ), list( type = 'list', key = 'map', list = list( list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'google.co.uk' ), list( type = 'template', key = 'value', value = 'UA-123456-1' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'bing.com' ), list( type = 'template', key = 'value', value = 'UA-123456-2' ) ) ) ) ) ) ) lookupTable <- gtm_variables_create(accountId, containerId, workspaceId, variable2) ## End(Not run)
This deletes a variable in a GTM workspace
gtm_variables_delete( account_id, container_id, workspace_id, variable_id, force = c(TRUE, FALSE) )
gtm_variables_delete( account_id, container_id, workspace_id, variable_id, force = c(TRUE, FALSE) )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable_id |
Variable Id |
force |
Force deletion without user input |
Other variable functions:
gtm_variables_create()
,
gtm_variables_get()
,
gtm_variables_list()
,
gtm_variables_revert()
,
gtm_variables_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId <- 30 gtm_variables_delete(accountId, containerId, workspaceId, variableId) # This will delete tag %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Variable 30 has been deleted. variableId = 31 gtm_variables_delete(accountId, containerId, workspaceId, variableId, "TRUE") # Variable 31 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId <- 30 gtm_variables_delete(accountId, containerId, workspaceId, variableId) # This will delete tag %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Variable 30 has been deleted. variableId = 31 gtm_variables_delete(accountId, containerId, workspaceId, variableId, "TRUE") # Variable 31 has been deleted. ## End(Not run)
This will return a list with the settings of a single variable.
If you want to get the information for all variables, use gtm_variables_list
gtm_variables_get(account_id, container_id, workspace_id, variable_id)
gtm_variables_get(account_id, container_id, workspace_id, variable_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable_id |
Variable Id |
Other variable functions:
gtm_variables_create()
,
gtm_variables_delete()
,
gtm_variables_list()
,
gtm_variables_revert()
,
gtm_variables_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId = 100 variable <- gtm_variables_get(accountId, containerId, workspaceId, variableId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId = 100 variable <- gtm_variables_get(accountId, containerId, workspaceId, variableId) ## End(Not run)
This will return a data frame all your available variables in a given workspace
If you want to get the information for a single variable, use gtm_variables_get
gtm_variables_list(account_id, container_id, workspace_id)
gtm_variables_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other variable functions:
gtm_variables_create()
,
gtm_variables_delete()
,
gtm_variables_get()
,
gtm_variables_revert()
,
gtm_variables_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variables <- gtm_variables_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variables <- gtm_variables_list(accountId, containerId, workspaceId) ## End(Not run)
This reverts a variable back to its original, unmodified state.
gtm_variables_revert(account_id, container_id, workspace_id, variable_id)
gtm_variables_revert(account_id, container_id, workspace_id, variable_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable_id |
Variable Id |
Other variable functions:
gtm_variables_create()
,
gtm_variables_delete()
,
gtm_variables_get()
,
gtm_variables_list()
,
gtm_variables_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId <- 102 variable <- gtm_variables_revert(accountId, containerId, workspaceId, variableId) # Changes to variable 22 have been reverted ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 variableId <- 102 variable <- gtm_variables_revert(accountId, containerId, workspaceId, variableId) # Changes to variable 22 have been reverted ## End(Not run)
This takes a variable resource and overwrites the existing variable in GTM
gtm_variables_update( account_id, container_id, workspace_id, variable_id, variable_object )
gtm_variables_update( account_id, container_id, workspace_id, variable_id, variable_object )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
variable_id |
Variable Id |
variable_object |
Variable Object |
Other variable functions:
gtm_variables_create()
,
gtm_variables_delete()
,
gtm_variables_get()
,
gtm_variables_list()
,
gtm_variables_revert()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 updatedVariable <- list( name = 'Lookup Table', type = 'smm', parameter = list( list( type = 'boolean', key = 'setDefaultValue', value = 'false' ), list( type = 'template', key = 'input', value = '{{Page Hostname}}' ), list( type = 'list', key = 'map', list = list( list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'google.co.uk' ), list( type = 'template', key = 'value', value = 'UA-123456-1' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'bing.com' ), list( type = 'template', key = 'value', value = 'UA-123456-2' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'yahoo.com' ), list( type = 'template', key = 'value', value = 'UA-123456-3' ) ) ) ) ) ) ) newLookupTable <- gtm_variables_create(accountId, containerId, workspaceId, updatedVariable) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 3 updatedVariable <- list( name = 'Lookup Table', type = 'smm', parameter = list( list( type = 'boolean', key = 'setDefaultValue', value = 'false' ), list( type = 'template', key = 'input', value = '{{Page Hostname}}' ), list( type = 'list', key = 'map', list = list( list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'google.co.uk' ), list( type = 'template', key = 'value', value = 'UA-123456-1' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'bing.com' ), list( type = 'template', key = 'value', value = 'UA-123456-2' ) ) ), list( type = 'map', map = list(list( type = 'template', key = 'key', value = 'yahoo.com' ), list( type = 'template', key = 'value', value = 'UA-123456-3' ) ) ) ) ) ) ) newLookupTable <- gtm_variables_create(accountId, containerId, workspaceId, updatedVariable) ## End(Not run)
Deletes a container version
gtm_versions_delete( account_id, container_id, version_id, force = c("TRUE", "FALSE") )
gtm_versions_delete( account_id, container_id, version_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
force |
Force deletion without user input |
Other version functions:
gtm_versions_get()
,
gtm_versions_update()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 gtm_versions_delete(accountId, containerId, versionId) # This will delete Version %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Version 6 has been deleted. tagId = 7 gtm_versions_delete(accountId, containerId, versionId, "TRUE") # Version 7 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 gtm_versions_delete(accountId, containerId, versionId) # This will delete Version %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Version 6 has been deleted. tagId = 7 gtm_versions_delete(accountId, containerId, versionId, "TRUE") # Version 7 has been deleted. ## End(Not run)
This returns a single workspace version
gtm_versions_get(account_id, container_id, version_id)
gtm_versions_get(account_id, container_id, version_id)
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
Other version functions:
gtm_versions_delete()
,
gtm_versions_update()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_get(accountId, containerId, versionId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_get(accountId, containerId, versionId) ## End(Not run)
Publishes a container version to be live
gtm_versions_publish(account_id, container_id, version_id)
gtm_versions_publish(account_id, container_id, version_id)
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
Other versions functions:
gtm_versions_setlatest()
,
gtm_versions_undelete()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_publish(accountId, containerId, versionId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_publish(accountId, containerId, versionId) ## End(Not run)
Sets the given container version as the latest version
gtm_versions_setlatest(account_id, container_id, version_id)
gtm_versions_setlatest(account_id, container_id, version_id)
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
Other versions functions:
gtm_versions_publish()
,
gtm_versions_undelete()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_setlatest(accountId, containerId, versionId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_setlatest(accountId, containerId, versionId) ## End(Not run)
Undeletes a container version
gtm_versions_undelete(account_id, container_id, version_id)
gtm_versions_undelete(account_id, container_id, version_id)
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
Other versions functions:
gtm_versions_publish()
,
gtm_versions_setlatest()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_undelete(accountId, containerId, versionId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 version <- gtm_versions_undelete(accountId, containerId, versionId) ## End(Not run)
Updates a container Version
gtm_versions_update( account_id, container_id, version_id, name = NULL, description = NULL )
gtm_versions_update( account_id, container_id, version_id, name = NULL, description = NULL )
account_id |
Account Id |
container_id |
Container Id |
version_id |
Version Id |
name |
Version Name |
description |
Version Description |
Other version functions:
gtm_versions_delete()
,
gtm_versions_get()
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 newName <- 'My Cool New Version' newDescription <- 'My new version does something cool' version <- gtm_versions_update(accountId, containerId, versionId, newName, newDescription) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 versionId <- 6 newName <- 'My Cool New Version' newDescription <- 'My new version does something cool' version <- gtm_versions_update(accountId, containerId, versionId, newName, newDescription) ## End(Not run)
This creates a new workspace in an esisting container.
gtm_workspaces_create(account_id, container_id, name, description = NULL)
gtm_workspaces_create(account_id, container_id, name, description = NULL)
account_id |
Account Id |
container_id |
Container Id |
name |
Workspace Name |
description |
Workspace Description |
Other workspace functions:
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 name <- 'New Analytics Tags' description <- 'Adding element visibility tags' workspace <- gtm_workspaces_create(accountId, containerId, name, description) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 name <- 'New Analytics Tags' description <- 'Adding element visibility tags' workspace <- gtm_workspaces_create(accountId, containerId, name, description) ## End(Not run)
This irrevocably deletes a workspace and any work in it.
gtm_workspaces_delete( account_id, container_id, workspace_id, force = c("TRUE", "FALSE") )
gtm_workspaces_delete( account_id, container_id, workspace_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
force |
Force deletion without user input |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 84 gtm_workspaces_delete(accountId, containerId, workspaceId) # This will delete Workspace %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Workspace 84 has been deleted. workspaceId = 85 gtm_workspaces_delete(accountId, containerId, workspaceId, "TRUE") # Workspace 85 has been deleted. ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 84 gtm_workspaces_delete(accountId, containerId, workspaceId) # This will delete Workspace %s. Are you sure you want to continue? # 1: Yes # 2: No # Selection: 1 # Workspace 84 has been deleted. workspaceId = 85 gtm_workspaces_delete(accountId, containerId, workspaceId, "TRUE") # Workspace 85 has been deleted. ## End(Not run)
This returns a list containing the metadata about a single Workspace
If you want to get the information for all workspaces, use gtm_workspaces_list
gtm_workspaces_get(account_id, container_id, workspace_id)
gtm_workspaces_get(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 workspace <- gtm_workspaces_get(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 5 workspace <- gtm_workspaces_get(accountId, containerId, workspaceId) ## End(Not run)
This will return a data frame all your available workspaces in a given container.
If you want to get the information for a single workspace, use gtm_workspaces_get
gtm_workspaces_list(account_id, container_id)
gtm_workspaces_list(account_id, container_id)
account_id |
Account Id |
container_id |
Container Id |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaces <- gtm_workspaces_list(accountId, containerId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaces <- gtm_workspaces_list(accountId, containerId) ## End(Not run)
Quick previews a workspace by creating a fake container version from all entities in the provided workspace. It returns a container object, and if there are any conflicts, sync errors or compiler errors in the workspace
gtm_workspaces_preview(account_id, container_id, workspace_id)
gtm_workspaces_preview(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Invisibly, the server response. If successful this is list with one element.
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 preview <- gtm_workspaces_preview(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 preview <- gtm_workspaces_preview(accountId, containerId, workspaceId) ## End(Not run)
Resolves a merge conflict for a workspace entity by updating it to the resolved entity passed in the request. This is one of the more complex functions, however if you are using this package for automation you will most probably want to keep the version from the current workspace not the base version, which is shown in hte example.
gtm_workspaces_resolve( account_id, container_id, workspace_id, tag = NULL, trigger = NULL, variable = NULL, folder = NULL, changeStatus = c("added", "changeStatusUnspecified", "deleted", "none", "updated") )
gtm_workspaces_resolve( account_id, container_id, workspace_id, tag = NULL, trigger = NULL, variable = NULL, folder = NULL, changeStatus = c("added", "changeStatusUnspecified", "deleted", "none", "updated") )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
tag |
A Tag Object |
trigger |
A Trigger Object |
variable |
A Variable Object |
folder |
A Folder Object |
changeStatus |
Represents how the entity has been changed in the workspace. |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: # Comlpexities arise converting the list created in R into the correct JSON for GTM, # specifically for the Monitoring Metadata in Tags, so this is brought out, converted # separately and then included in the tag before it is resolved. accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 mergeConflicts <- gtm_workspaces_sync(accountId, containerId, workspaceId) for(i in 1:nrow(mergeConflicts$mergeConflict$entityInWorkspace)){ tag <- NULL trigger <- NULL variable <- NULL folder <- NULL obj <- mergeConflicts$mergeConflict$entityInWorkspace[i,] if(!is.na(obj$tag$path)){ tag <- obj$tag if(is.null(tag$monitoringMetadata$map)){ tag <- tag %>% select(-monitoringMetadata) tag <- as.list(tag) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } else{ metadataMap <- tag$monitoringMetadata$map[[1]] metadata <- list( type = 'map', map = metadataMap ) tag <- as.list(tag) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) tag$monitoringMetadata <- metadata } } if(!is.na(obj$trigger$path)){ trigger <- obj$trigger trigger <- as.list(trigger) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } if(!is.na(obj$variable$path)){ variable <- obj$variable variable <- as.list(variable) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } if(!is.na(obj$folder$path)){ folder <- obj$folder folder <- as.list(folder) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } changeStatus <- obj$changeStatus resolve <- gtm_workspaces_resolve(account_id = accountId, container_id = containerId, workspace_id = workspaceId, tag = tag, trigger = trigger, variable = variable, folder = folder, changeStatus = changeStatus) } ## End(Not run)
## Not run: # Comlpexities arise converting the list created in R into the correct JSON for GTM, # specifically for the Monitoring Metadata in Tags, so this is brought out, converted # separately and then included in the tag before it is resolved. accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 mergeConflicts <- gtm_workspaces_sync(accountId, containerId, workspaceId) for(i in 1:nrow(mergeConflicts$mergeConflict$entityInWorkspace)){ tag <- NULL trigger <- NULL variable <- NULL folder <- NULL obj <- mergeConflicts$mergeConflict$entityInWorkspace[i,] if(!is.na(obj$tag$path)){ tag <- obj$tag if(is.null(tag$monitoringMetadata$map)){ tag <- tag %>% select(-monitoringMetadata) tag <- as.list(tag) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } else{ metadataMap <- tag$monitoringMetadata$map[[1]] metadata <- list( type = 'map', map = metadataMap ) tag <- as.list(tag) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) tag$monitoringMetadata <- metadata } } if(!is.na(obj$trigger$path)){ trigger <- obj$trigger trigger <- as.list(trigger) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } if(!is.na(obj$variable$path)){ variable <- obj$variable variable <- as.list(variable) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } if(!is.na(obj$folder$path)){ folder <- obj$folder folder <- as.list(folder) %>% lapply(function(x){if(is.null(x[[1]])){x<-NA}else{x<-x}}) %>% lapply(function(x) x[!is.na(x)]) } changeStatus <- obj$changeStatus resolve <- gtm_workspaces_resolve(account_id = accountId, container_id = containerId, workspace_id = workspaceId, tag = tag, trigger = trigger, variable = variable, folder = folder, changeStatus = changeStatus) } ## End(Not run)
Finds conflicting and modified entities in the workspace.
gtm_workspaces_status(account_id, container_id, workspace_id)
gtm_workspaces_status(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 workspace <- gtm_workspaces_status(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 workspace <- gtm_workspaces_status(accountId, containerId, workspaceId) ## End(Not run)
This creates a new version of the GTM container, but does not publish it as a live version. The name and notes will be permanently visible for the container version.
gtm_workspaces_submit( account_id, container_id, workspace_id, name, notes = NULL )
gtm_workspaces_submit( account_id, container_id, workspace_id, name, notes = NULL )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
name |
Version Name |
notes |
Version Notes |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_sync()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 name <- 'New Analytics Tags' notes <- 'Adding element visibility tags and scroll tracking' workspace <- gtm_workspaces_update(accountId, containerId, workspaceId, name, notes) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 name <- 'New Analytics Tags' notes <- 'Adding element visibility tags and scroll tracking' workspace <- gtm_workspaces_update(accountId, containerId, workspaceId, name, notes) ## End(Not run)
Syncs a workspace to the latest container version by updating all unmodified workspace entities and displaying conflicts for modified entities
gtm_workspaces_sync(account_id, container_id, workspace_id)
gtm_workspaces_sync(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 syncResult <- gtm_workspaces_sync(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 syncResult <- gtm_workspaces_sync(accountId, containerId, workspaceId) ## End(Not run)
This updates the name or description of an existing workspace.
gtm_workspaces_update( account_id, container_id, workspace_id, name, description = NULL )
gtm_workspaces_update( account_id, container_id, workspace_id, name, description = NULL )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
name |
Workspace Name |
description |
Workspace Description |
Other workspace functions:
gtm_workspaces_create()
,
gtm_workspaces_delete()
,
gtm_workspaces_get()
,
gtm_workspaces_list()
,
gtm_workspaces_preview()
,
gtm_workspaces_resolve()
,
gtm_workspaces_status()
,
gtm_workspaces_submit()
,
gtm_workspaces_sync()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 name <- 'New Analytics Tags' description <- 'Adding element visibility tags and scroll tracking' workspace <- gtm_workspaces_update(accountId, containerId, workspaceId, name, description) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 6 name <- 'New Analytics Tags' description <- 'Adding element visibility tags and scroll tracking' workspace <- gtm_workspaces_update(accountId, containerId, workspaceId, name, description) ## End(Not run)
This takes a zone resource and creates a new zone in GTM.
gtm_zones_create(account_id, container_id, workspace_id, zone_object)
gtm_zones_create(account_id, container_id, workspace_id, zone_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
zone_object |
Zone Object |
Other zone functions:
gtm_zones_delete()
,
gtm_zones_get()
,
gtm_zones_list()
,
gtm_zones_revert()
,
gtm_zones_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 zone <- list( accountId=accountId, containerId=containerId, workspaceId=workspaceId, name="Marketing Zone", childContainer=list( list( publicId="GTM-ABCDEF", nickname="My Marketing Container" ) ) ) new_zone <- gtm_zones_create(accountId, containerId, workspaceId, zone) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 10 zone <- list( accountId=accountId, containerId=containerId, workspaceId=workspaceId, name="Marketing Zone", childContainer=list( list( publicId="GTM-ABCDEF", nickname="My Marketing Container" ) ) ) new_zone <- gtm_zones_create(accountId, containerId, workspaceId, zone) ## End(Not run)
This deletes a zone in a GTM workspace
gtm_zones_delete( account_id, container_id, workspace_id, zone_id, force = c("TRUE", "FALSE") )
gtm_zones_delete( account_id, container_id, workspace_id, zone_id, force = c("TRUE", "FALSE") )
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
zone_id |
Zone Id |
force |
Force deletion without user input |
Other zone functions:
gtm_zones_create()
,
gtm_zones_get()
,
gtm_zones_list()
,
gtm_zones_revert()
,
gtm_zones_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 3 gtm_zones_delete(accountId, containerId, workspaceId, zoneId, "TRUE") ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 3 gtm_zones_delete(accountId, containerId, workspaceId, zoneId, "TRUE") ## End(Not run)
This will return a list with the settings of a single zone.
If you want to get the information for all zones, use gtm_zones_list
gtm_zones_get(account_id, container_id, workspace_id, zone_id)
gtm_zones_get(account_id, container_id, workspace_id, zone_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
zone_id |
Zone Id |
Other zone functions:
gtm_zones_create()
,
gtm_zones_delete()
,
gtm_zones_list()
,
gtm_zones_revert()
,
gtm_zones_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 12 zone <- gtm_zones_get(accountId, containerId, workspaceId, zoneId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 12 zone <- gtm_zones_get(accountId, containerId, workspaceId, zoneId) ## End(Not run)
This will return a data frame all your available zones in a given workspace
If you want to get the information for a single zone, use gtm_zones_get
gtm_zones_list(account_id, container_id, workspace_id)
gtm_zones_list(account_id, container_id, workspace_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
Other zone functions:
gtm_zones_create()
,
gtm_zones_delete()
,
gtm_zones_get()
,
gtm_zones_revert()
,
gtm_zones_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zones <- gtm_zones_list(accountId, containerId, workspaceId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zones <- gtm_zones_list(accountId, containerId, workspaceId) ## End(Not run)
This reverts a zone back to its original, unmodified state.
gtm_zones_revert(account_id, container_id, workspace_id, zone_id)
gtm_zones_revert(account_id, container_id, workspace_id, zone_id)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
zone_id |
Zone Id |
Other zone functions:
gtm_zones_create()
,
gtm_zones_delete()
,
gtm_zones_get()
,
gtm_zones_list()
,
gtm_zones_update()
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 5 zone <- gtm_zones_revert(accountId, containerId, workspaceId, zoneId) ## End(Not run)
## Not run: accountId <- 1234567 containerId <- 7654321 workspaceId <- 11 zoneId <- 5 zone <- gtm_zones_revert(accountId, containerId, workspaceId, zoneId) ## End(Not run)
This takes a zone resource and overwrites the existing zone in GTM
gtm_zones_update(account_id, container_id, workspace_id, zone_id, zone_object)
gtm_zones_update(account_id, container_id, workspace_id, zone_id, zone_object)
account_id |
Account Id |
container_id |
Container Id |
workspace_id |
Workspace Id |
zone_id |
Zone Id |
zone_object |
Zone Object |
Other zone functions:
gtm_zones_create()
,
gtm_zones_delete()
,
gtm_zones_get()
,
gtm_zones_list()
,
gtm_zones_revert()
These are the variable names accepted when enabling/disabling Built-In Variables
advertiserId |
Advertiser Id - Firebase |
advertisingTrackingEnabled |
Advertiser Tracking Enabled - Firebase |
ampBrowserLanguage |
Browser Language - AMP |
ampCanonicalHost |
Cannonical Host - AMP |
ampCanonicalPath |
Canonical Path - AMP |
ampCanonicalUrl |
Canonical URL - AMP |
ampClientId |
Page Client ID - AMP |
ampClientMaxScrollX |
Scroll Width - AMP |
ampClientMaxScrollY |
Scroll Height - AMP |
ampClientScreenHeight |
Screen Height - AMP |
ampClientScreenWidth |
Screen Width - AMP |
ampClientScrollX |
Scroll Left - AMP |
ampClientScrollY |
Scroll Top - AMP |
ampClientTimestamp |
Client Timestamp - AMP |
ampClientTimezone |
Client Timezone - AMP |
ampGtmEvent |
AMP Event - AMP |
ampPageDownloadTime |
Page Downlad Time - AMP |
ampPageLoadTime |
Page Load Time - AMP |
ampPageViewId |
Page View Id - AMP |
ampReferrer |
Document Referrer - AMP |
ampTitle |
Document Title - AMP |
ampTotalEngagedTime |
Total Engaged Time - AMP |
appId |
App Id - Firebase |
appName |
App Name- Firebase |
appVersionCode |
App Version Code - Firebase |
appVersionName |
App Version Name - Firebase |
builtInVariableTypeUnspecified |
Undefined |
clickClasses |
Click Classes |
clickElement |
Click Element |
clickId |
Click Id |
clickTarget |
Click Target |
clickText |
Click Text |
clickUrl |
Click URL |
containerId |
Container ID |
containerVersion |
Container Version |
debugMode |
Debug Mode |
deviceName |
Device Name |
elementVisibilityFirstTime |
Element First Visible |
elementVisibilityRatio |
Percent Visible |
elementVisibilityRecentTime |
Element Last Visible |
elementVisibilityTime |
On Screen Duration |
environmentName |
Environment Name |
errorLine |
Error Line |
errorMessage |
Error Message |
errorUrl |
Error URL |
event |
Event |
eventName |
Event Name |
firebaseEventParameterCampaign |
Campaign Name - Firebase |
firebaseEventParameterCampaignAclid |
Click Id (aclid) - Firebase |
firebaseEventParameterCampaignAnid |
Ad Network ID (anid) - Firebase |
firebaseEventParameterCampaignClickTimestamp |
Campaign Click Timestamp - Firebase |
firebaseEventParameterCampaignContent |
Campaign Content - Firebase |
firebaseEventParameterCampaignCp1 |
Campaign Custom Parameter 1 - Firebase |
firebaseEventParameterCampaignGclid |
Google Click Id (gclid) - Firebase |
firebaseEventParameterCampaignSource |
Campaign Source - Firebase |
firebaseEventParameterCampaignTerm |
Campaign Search Term - Firebase |
firebaseEventParameterCurrency |
In-app Purchase Currency - Firebase |
firebaseEventParameterDynamicLinkAcceptTime |
Dynamic Link Accept Time - Firebase |
firebaseEventParameterDynamicLinkLinkid |
Dynamic Link ID - Firebase |
firebaseEventParameterNotificationMessageDeviceTime |
Notification Device Time - Firebase |
firebaseEventParameterNotificationMessageId |
Notification Message Id - Firebase |
firebaseEventParameterNotificationMessageName |
Notification Message Name - Firebase |
firebaseEventParameterNotificationMessageTime |
Notification Message Time - Firebase |
firebaseEventParameterNotificationTopic |
Notification Message Topic - Firebase |
firebaseEventParameterPreviousAppVersion |
Previous Application Version - Firebase |
firebaseEventParameterPreviousOsVersion |
Previous OS Version - Firebase |
firebaseEventParameterPrice |
In-app Purchase Price - Firebase |
firebaseEventParameterProductId |
In-app Purchase Product ID - Firebase |
firebaseEventParameterQuantity |
In-app Purchase Quantity - Firebase |
firebaseEventParameterValue |
In-app Purchase Value - Firebase |
formClasses |
Form Classes |
formElement |
Form Element |
formId |
Form Id |
formTarget |
Form Target |
formText |
Form Text |
formUrl |
Form URL |
historySource |
History Source |
htmlId |
HTML ID |
language |
Language |
newHistoryFragment |
New History Fragment |
newHistoryState |
New History State |
newHistoryUrl |
New History URL |
oldHistoryFragment |
Old History Fragment |
oldHistoryState |
Old History Stat |
oldHistoryUrl |
Old History URL |
osVersion |
OS Version |
pageHostname |
Page Hostname |
pagePath |
Page Path |
pageUrl |
Page URL |
platform |
Platform |
randomNumber |
Random Number |
referrer |
Referrer |
resolution |
Screen Resolution |
scrollDepthDirection |
Scroll Depth Direction |
scrollDepthThreshold |
Scroll Depth Threshold |
scrollDepthUnits |
Scroll Depth Units |
sdkVersion |
SDK Version - Firebase |
videoCurrentTime |
Video Current Time |
videoDuration |
Video Duration |
videoPercent |
Video Percent |
videoProvider |
Video Provider |
videoStatus |
Video Status |
videoTitle |
Video Title |
videoUrl |
Video URL |
videoVisible |
Video Visible |
Other built in variable functions:
gtm_builtin_create()
,
gtm_builtin_delete()
,
gtm_builtin_list()
,
gtm_builtin_revert()