Learn R Programming

googleAnalyticsR (version 1.2.0)

ga_users_delete_linkid: Delete users access from account, webproperty or view level

Description

The linkId is in the form of the accountId/webPropertyId/viewId colon separated from a link unique Id.

Delete user access by supplying the linkId for that user at the level they have been given access. It won't work to delete user links at account level if they have been assigned at web property or view level - you will need to get the linkId for that level instead. e.g. a user needs permissions.local to be non-NULL to be deleted at that level. The parameter check will do this check before deletion and throw an error if they can not be deleted. Set this to check=FALSE to suppress this behaviour.

If you supply more than one linkId, then batch processing will be applied. Batching has special rules that give you 30 operations for the cost of one API call against your quota. When batching you will only get a TRUE result on successful batch, but individual linkIds may have failed. Check via ga_users_list afterwards and try to delete individual linkIds to get more descriptive error messages.

Usage

ga_users_delete_linkid(
  linkId,
  accountId,
  webPropertyId = NULL,
  viewId = NULL,
  check = TRUE
)

Value

TRUE if the deletion is successful, an error if not.

Arguments

linkId

The linkId(s) that is available using ga_users_list e.g. 47480439:104185380183364788718

accountId

Account Id

webPropertyId

Web Property Id - set to NULL to operate on account level only

viewId

viewId - set to NULL to operate on webProperty level only

check

If the default TRUE will check that the user has user access at the level you are trying to delete them from - if not will throw an error.

See Also

Google Documentation

Other User management functions: ga_users_add(), ga_users_delete(), ga_users_list(), ga_users_update()

Examples

Run this code

if (FALSE) {

library(googleAnalyticsR)
ga_auth()

# get the linkId for the user you want to delete
ga_users_list(47480439, webPropertyId = "UA-47480439-2", viewId = 81416156)
ga_users_delete_linkid("81416156:114834495587136933146", 
                       accountId = 47480439, 
                       webPropertyId = "UA-47480439-2", 
                       viewId = 81416156)

# check its gone
ga_users_list(47480439, webPropertyId = "UA-47480439-2", viewId = 81416156)

# can only delete at level user has access, the above deletion woud have failed if via:
ga_users_delete_linkid("47480439:114834495587136933146", 47480439)

}

Run the code above in your browser using DataLab