skardhamar / rga

R Google Analytics
186 stars 88 forks source link

Feature: Metadata API #54

Open mattpolicastro opened 10 years ago

mattpolicastro commented 10 years ago

I'm fairly new to R and Analytics, so please forgive me if this duplicates earlier requests or is outside the scope of this project:

I'd love to be able to quickly replace metrics/dimensions as column names with their uiName attribute when I graph/table them into my final report (e.g. pageviewsPerSession would become "Pages / Session", per the Dev Guide). Is there any way to tack on a Metadata API call to avoid complex/maintenance-heavy find/replace code?

MarkEdmondson1234 commented 10 years ago

This would be quite cool, and perhaps if using the Metadata API anyway it could be used to verify the call you are making to GA, to check the correct dimension/metrics are being used.

One thing though, is that R data frames do not support spaces, funny characters etc. so your example "Pages / Session" would need to be added to a final output, not kept in the dataframe itself. Perhaps something like a csv parser for when you are exporting? e.g.

GAcsv.writer(rgadataframe, "./data/rga_data.csv")
mattpolicastro commented 10 years ago

Quite possibly, though I would prefer being able to insert the uiName attribute as the first value to the data frame itself immediately before passing it to my output functions/scripts. (I tend to keep most of my graphing and tabling in local memory, rather than saving to discrete files).

Edit: Regardless of preference, having reliable access to those attributes would a boon to my work.