rga.open: Open a GA API instance

Description Usage Arguments Value Note Examples

View source: R/init.R

Description

This function creates a Google Analytics API instance, bound to one Google Account.

Usage

1
  rga.open(instance = "ga", client.id, client.secret, where, envir = .GlobalEnv)

Arguments

instance

this should be the name of your reference handle. By default it's set to \"ga\". This will be the class, that will carry all the API functions and token data.

client.id

this should be set the client id provided by Google Analytics API. By default it is set to a default application.

client.secret

this should be set the client secret provided by Google Analytics API. By default it is set to a default application.

where

if this is set to an arbitrary file, the instance will be saved here and later acquired from here. Use this for continous work with the Google Analytics API.

envir

where should the instance be stored.

Value

This function returns an class of type rga, this contains all the methods for data extraction, and keeps itself authenticated.

Note

When this function runs for the first time, it will open an available browser, and direct you to the authentication on Google. You need to accept the authentication, and copy the code Google gives you, this code needs to be inputted into the console.

If you can't run the function interactively (on a server for example), just create the instance in an environment where you can, and copy the instance to the non-interactive environment.

Examples

1
2
3
4
5
6
7
8
  ## Not run: 
    rga.open(instance = "ga");
    profiles <- ga$getProfiles();

    # explore class:
    ga$getRefClass()
  
## End(Not run)

skardhamar/rga documentation built on May 30, 2019, 1 a.m.