gtm_workspaces_resolve {googleTagManageR} | R Documentation |
Resolve workspace conflicts
Description
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.
Usage
gtm_workspaces_resolve(
account_id,
container_id,
workspace_id,
tag = NULL,
trigger = NULL,
variable = NULL,
folder = NULL,
changeStatus = c("added", "changeStatusUnspecified", "deleted", "none", "updated")
)
Arguments
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. |
See Also
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()
Examples
## 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)
[Package googleTagManageR version 0.2.0 Index]