gtm_variables_update: Update an existing variable

View source: R/variables.R

gtm_variables_updateR Documentation

Update an existing variable

Description

This takes a variable resource and overwrites the existing variable in GTM

Usage

gtm_variables_update(
  account_id,
  container_id,
  workspace_id,
  variable_id,
  variable_object
)

Arguments

account_id

Account Id

container_id

Container Id

workspace_id

Workspace Id

variable_id

Variable Id

variable_object

Variable Object

See Also

https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/workspaces/variables/update

Other variable functions: gtm_variables_create(), gtm_variables_delete(), gtm_variables_get(), gtm_variables_list(), gtm_variables_revert()

Examples


## 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)


jamescottrill/googleTagManageR documentation built on April 21, 2022, 5:40 p.m.