In Short

The R way to interact with Google’s Tag Manager API.

Scope

At the moment listing of elements is available, but in the future both updates and delete will be supported. This is not a professional package and serves mostly as a way of organising code snippets for my work.

Credits

Most of this is adopted from the excellent autoGoogleAPI package from Mark Edmondson and his most awesome googleAnalyticsR that I use daily.

Installation

To install the package in your R setup just use devtools and the install_github() function like below

install.packages('devtools')
devtools::install_github(username = 'IronistM',repo = 'googleTagManageR')

Examples

Authenticate to GTM API

gtm_auth()

List Accounts you have access

gtm_accounts_list()

Let’s say you want to get the details from YOUR_ACCOUNT_ID, then you use the following

gtm_account(accountId = YOUR_ACCOUNT_ID)

List Containers per account

Similarly, to get the containers of YOUR_ACCOUNT_ID, use the following

gtm_containers_list(accountId = YOUR_ACCOUNT_ID)