ga_custom_upload_file: Upload data to Google Analytics

View source: R/custom_data_source.R

ga_custom_upload_fileR Documentation

Upload data to Google Analytics

Description

Upload external data up to 1GB to Google Analytics via the management API.

Usage

ga_custom_upload_file(accountId, webPropertyId, customDataSourceId, upload)

Arguments

accountId

Account Id

webPropertyId

Web Property Id

customDataSourceId

Custom data source Id

upload

An R data.frame or a file path location (character)

Details

You need to create a custom data source in the web UI first.

If you are uploading an R data frame, the function will prefix the column names with "ga:" for you if necessary.

After upload check the status by querying data sources using ga_custom_upload and examining the status field.

Currently only supports simple uploads (not resumable).

Value

An object of class ga_custom_data_source_upload

See Also

A guide for preparing the data is available: from Google here.

The dev guide for this function: Data Import Developer Guide

Other custom datasource functions: ga_custom_datasource(), ga_custom_upload_delete(), ga_custom_upload_list(), ga_custom_upload()

Examples


## Not run: 

upload_me <- data.frame(medium = "shinyapps", 
                        source = "referral", 
                        adCost = 1, 
                        date = "20160801")
                        
obj <- ga_custom_upload_file(47850439, 
                             "UA-4748043-2", 
                             "_jDsJHSFSU-uw038Bh8fUg", 
                             upload_me)
                             
## obj will initially have status = PENDING
obj
==Google Analytics Custom Data Source Upload==
Custom Data Source ID:  _jDsJHSFSU-uw038Bh8fUg 
Account ID:             47850439 
Web Property Id:        UA-4748043-2 
Upload ID:              7yHLAkeLSiK1zveVTiWZwA 
Status:                 PENDING 

## Send obj to ga_custom_upload() to check and renew status
obj <- ga_custom_upload(upload_object = obj)
obj

==Google Analytics Custom Data Source Upload==
Custom Data Source ID:  _jDsJHSFSU-uw038Bh8fUg 
Account ID:             47850439 
Web Property Id:        UA-4748043-2 
Upload ID:              7yHLAkeLSiK1zveVTiWZwA 
Status:                 COMPLETED 


## End(Not run)



MarkEdmondson1234/googleAnalyticsR documentation built on Oct. 13, 2023, 4:40 a.m.