ganalytics (version 0.10.7)

Var: Var

Description

Google Analytics dimension and metric variables.

Var<- sets the value of an object belonging to the superclass .var or sets the var slot of an expression object belonging to superclass .expr

Usage

Var(object, ...)

Var(object) <- value

GaVar(object, ...)

GaVar(object) <- value

McfVar(object, ...)

McfVar(object) <- value

RtVar(object, ...)

RtVar(object) <- value

# S4 method for character Var(object)

# S4 method for .var,character Var(object) <- value

# S4 method for .expr Var(object)

# S4 method for .expr,character Var(object) <- value

# S4 method for .gaVarList Var(object)

# S4 method for character GaVar(object)

# S4 method for .gaVar,character GaVar(object) <- value

# S4 method for .expr GaVar(object)

# S4 method for .expr,character GaVar(object) <- value

# S4 method for .gaVarList GaVar(object)

# S4 method for ANY McfVar(object)

# S4 method for ANY RtVar(object)

Arguments

object

An object that inherits from or extends the class .var, including gaDimVar, gaMetVar, mcfDimVar, mcfMetVar, rtDimVar, rtMetVar, gaExpr, mcfExpr, rtExpr, gaDimensions, gaMetrics, mcfDimensions, mcfMetrics, rtDimensions and rtMetrics.

...

A replacement value for object coerced to class .var.

value

any object that can be coerced to a valid object class.

Value

An object inheriting from the superclass .var

Methods (by class)

  • character: Coerce a character to '.var'.

  • object = .var,value = character: Set a '.var' object to a new value coerced from character.

  • .expr: Get the variable of an expression object.

  • object = .expr,value = character: Set the variable of an expression object using a character value to be coerced to '.var'.

  • .gaVarList: Get the variables within a variable list object, such as sortBy, dimensions or metrics.

  • character: GaVar takes a GA variable name and determines whether to return a Dimension or Metric object

  • object = .gaVar,value = character: Set the Var of a gaExpr object.

  • .expr: Get the variable from expression object coerced to '.garVar'.

  • object = .expr,value = character: Set the variable of an expression to a .gaVar as named by a character value.

  • .gaVarList: Get the variables of a .gaVarList.

  • ANY: McfVar takes a MCF variable and determines whether to return a Dimension or Metric object

  • ANY: McfVar takes a RT variable and determines whether to return a Dimension or Metric object

Details

Var returns a .var object which is valid Google Analytics dimension or metric for use with the core reporting, multi-channel-funnel reporting or real-time reporting API.

Use Var to lookup a dimension or metric from the Google Analytics core reporting, multi-channel-funnel reporting, or real-time reporting APIs, for use in defining expressions (of superclass .expr) or (to be implemented) variable lists (of superclass .varList) such as query dimensions, metrics or sortBy parameters.

Var accepts either a character, .var, or .expr object. A character object will be coerced to a .var object by looking for a matching dimension or metric from the Core Reporting, Multi-Channel Funnel Reporting, and Real-Time Reporting APIs. Providing an .expr object will return the dimension or metric used within that Google Analytics expression.

See Also

Examples

Run this code
# NOT RUN {
Var("source")
dim <- Var("ga:medium")
Var(dim)
paid_traffic <- Expr(dim, "==", "cpc")
Var(paid_traffic)

expr1 <- Expr("pageviews", '>', 10)
Var(expr1) <- "uniquePageviews"

# }

Run the code above in your browser using DataLab