RGA icon indicating copy to clipboard operation
RGA copied to clipboard

vapply error when using fetch.by = day and ga:sessionDuration

Open lcormaw opened this issue 8 years ago • 0 comments

Hi,

When using a fetch.by = day, here is the error and traceback:

Error in vapply(x, function(x) as.numeric(x[[name]]), numeric(1)) : 
  values must be length 1,
but FUN(X[[1]]) result is length 0
> traceback()
5: vapply(x, function(x) as.numeric(x[[name]]), numeric(1))
4: sum_by(pages, "sampleSize")
3: fetch_by(path, query, by, token)
2: get_report("data/ga", query, token, fetch.by)

The query was:

get_ga(profileId = ga_id,
            start.date = "2016-01-01",
            end.date = "2016-11-01",
            metrics = "ga:sessions,ga:bounces,ga:sessionDuration,ga:pageviews,ga:goal7Completions,ga:goal17Completions,ga:goal18Completions",
            dimensions = "ga:date,ga:yearMonth,ga:landingPagePath,ga:dcmClickSitePlacement,ga:dcmClickCampaign,ga:dcmClickSite",
            filters = "ga:dcmClickCampaign=~xxxxxxxx",
            fetch.by = "day"
)

After playing with the date range, it appears to be caused by the absence of data returned for one day (where the filter does not match anything). Is there any workaround to this without having to find the problematic date manually?

Thanks for your help!

lcormaw avatar Nov 04 '16 00:11 lcormaw