martmal
martmal

Reputation: 1

Google Analytics Data API (GA4) in R - Filters

I´m testing out the GA Data API (for GA4 properties) in R, and I get the following error while trying to run the filter line (last one below):

data must be uniquely named but has duplicate columns

What can be causing that? I´ve followed the syntax described here:

Filter DSL for GA4 filters

ga_properties <- data.frame(brand = c("mybrand"),
                     property_id = c("123456789"))
test_properties <- filter(ga_properties, brand == "mybrand")
prop_ids <- test_properties$property_id

date_range <- c('2022-06-01', '2022-06-30')  
sel_dimensions <- c('customEvent:screen_name')
sel_metrics <- c('eventCount','totalUsers')
dimension_filter <- ga_data_filter(city=="Copenhagen" | city == "London")

Upvotes: 0

Views: 606

Answers (1)

MarkeD
MarkeD

Reputation: 2631

I can't reproduce this error, could you check you have latest version installed? In particular rlang>=1.02

Honing down the error you are getting it only needs this line?

> ga_data_filter(city=="Copenhagen" | city == "London")
===orGroup:  
[[1]]
--GA4 Filter:  
--| city 
----stringFilter:  
value:  Copenhagen | matchType:  EXACT | caseSensitive:  TRUE
[[2]]
--GA4 Filter:  
--| city 
----stringFilter:  
value:  London | matchType:  EXACT | caseSensitive:  TRUE

Upvotes: 0

Related Questions