doSegmentMacro: Quick setup of shinyga segments

Description Usage Arguments Value See Also Examples

Description

This function creates the menu and fetches the GA segments.

Usage

1
doSegmentMacro(input, output, session, token)

Arguments

input

Shiny input object.

output

Shiny output object.

session

Shiny session object.

token

GA token.

Value

A segment table

A DataTable called from ui.r by renderDataTable('SegmentTable')

A selectInput('menuSeg') called from ui.r by uiOutput("controlSeg") and input$menuSeg

See Also

Other shiny macro functions: authDropdownRow; metricSelect; renderAuthDropdownRow

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 


## client info taken from Google API console.
CLIENT_ID      <-  "xxxxx.apps.googleusercontent.com"
CLIENT_SECRET  <-  "xxxxxxxxxxxx"
CLIENT_URL     <-  'https://mark.shinyapps.io/ga-effect/'
## comment out for deployment, in for local testing via runApp(port=6423)
CLIENT_URL     <-  'http://127.0.0.1:6423'

securityCode <- createCode()

shinyServer(function(input, output, session)){

  ## returns list of token and profile.table
  auth <- doAuthMacro(input, output, session,
                      securityCode,
                      client.id     = CLIENT_ID,
                      client.secret = CLIENT_SECRET,
                      client.uri    = CLIENT_URL)

  ga.token         <- auth$token
  profile.table    <- auth$table

  segments <- doSegmentMacro(input, output, session,
                             token=ga.token())

  }

## End(Not run)

MarkEdmondson1234/shinyga documentation built on May 7, 2019, 3:34 p.m.