8-bit-sheep / googleAnalyticsR

Use the Google Analytics API from R
https://8-bit-sheep.com/googleAnalyticsR/
Other
259 stars 76 forks source link

ga_adwords_list function returns adWordsAccounts as character not as list #225

Open martijnvv opened 5 years ago

martijnvv commented 5 years ago

What goes wrong

The ga_adwords_list function returns a dataframe with a column "adWordsAccounts", which consists of either a single item or multiple items. They are returned as a charachter, not a list.

Steps to reproduce the problem

Especially relevant when multiple Adwords accounts are linked to a property

Expected output

Return a list instead of character

Actual output

Before you run your code, please run:

options(googleAuthR.verbose=2) and copy-paste the console output here.
Check it doesn't include any sensitive info like auth tokens or accountIds - you can usually just edit those out manually and replace with say XXX

'API Data failed to parse' diagnostics

If you have an error starting with:

API Data failed to parse.

remotes::install_github("MarkEdmondson1234/googleAuthR")
googleAuthR::gar_debug_parsing("gar_parse_error.rds")

Session Info

Please run sessionInfo() so we can check what versions of packages you have installed

MarkEdmondson1234 commented 5 years ago

Thanks @martijnvv - I have an example of a GA account to work from with multiple accounts, but could I check the structure is similar to what you get as well? Could you show the current output with an example of what you would expect? (Redact anything sensitive)

MarkEdmondson1234 commented 5 years ago

Give that a go with the latest GitHub version

martijnvv commented 5 years ago

It looks better, almost there. Two column that is not returning correct data/ format:

In my situation I have two connected groupnames in GA, these names correspond with the names shown in the "name" column in the dataframe.

In my query, it returns 10 rows in the dataframe. The assignment of the name is assigned like this:

  1. name1
  2. name2
  3. name1
  4. name2 etc.

However, in the actual dataset I have one group with 9 connected accounts and the other group with 1 connected account. So they shouldnt be spread 50/50

Also, profileIds column returns a comma separated list in character format. Might be better as a list instead. These are the view ID's in GA that are connected. Often multiple values.

I hope that makes sense. would love to share screens, etc. but it is fairly sensitive data.

MarkEdmondson1234 commented 5 years ago

I need a good example to work from to sort this out