Closed veseliy closed 9 years ago
The was workin in Query Feed Explorer, it work in last RGoogleAnalitics, but it dosen't work here((((( Filters like this: ga:sourceMedium=~^google / organic$|^google / cpc$ to not workin(( Error messege: Your query matched 0 results. Please verify your query using the Query Feed Explorer and re-run it. Error in GetDataFeed(query.uri) : no loop for break/next, jumping to top level
Can you re-check the Profile ID in your R query as well as in the Query Feed Explorer? They should be the same. There does not seem to be any syntactical error in the query.
query.list <- Init(start.date = "2014-09-08", end.date = "2014-09-14", dimensions = "ga:sourceMedium,ga:date", metrics ="ga:sessions,ga:transactions,ga:transactionRevenue,ga:adCost,ga:bounces", max.results = 10000, sort ="-ga:sessions",
filters="ga:sourceMedium=~^google / organic$|^google / cpc$",
table.id ="ga:4469547")
There u can see that is profile is correct((
This is odd. Can you try using an R query with the same date range as the one which worked in Query Feed Explorer (2nd to 9th September 2014)?
Thanks for the quick response. Let me reproduce this at my end.
It's definitely the filter expression.
I've come across similar problems where regexp expressions would work differently on Query Feed Explorer and R. My guess is that Query Feed Explorer has a pre-querying expression parsing step to escape characters or something because it always seems much more robust than R.
You could try escaping the /
and |
characters in R and see if that makes it.
Anyhow, I would simplify the filter field in analytics and fine tune it in R. For instance, I would set a filter like this
filters="ga:sourceMedium=~^google / [oc]"
(Which actually might be enough)
and then (assuming you have a dataframe df
with your report data) filter by sourceMedium allowing either google / organic
or google / cpc
values:
library(dplyr)
df %>%
filter(
sourceMedium == 'google / organic' | sourceMedium == 'google / cpc'
)
Hmmmm/// I dont now. In present version of RGoogleAnalitics this filtr works((((
And this: ga:sourceMedium=~yandexmar.+
How i can see requvest string(like this https://www.datasource.com/data?start-date={date.startOfQuarter}&end-date={date.today}.....)
I am doing some reserch. I will insert my felter in GA FEED and get from here ga%3AsourceMedium%3D~%5Egoogle%20%2F%20organic%24, the part of query URL and then i put this string into R and its works. I think problems in step where constracting query URL in R modul. Can u chek this?
@veseliy I am yet to research into this issue. Will update soon.
I am running into that issue as well. I need to have unsampled data on single URL level, so I need to use split_daywise and a filter containing the wanted URL. Now it naturally happens that a URL does not have traffic on every day. But instead of simply getting back "0" or not adding anything to ga.data and simply noticing me, I get an error that interrupts the whole script. As a result I can not use split_daywise and have to write the whole looping and error-catching on my own. That's not what I usually download R packages for... ;o)
@slarty667 I've created #8 to keep your Issue separate than the one being discussed in the current thread. I will code up a quick fix via exception handling.
Thank you! Maybe a new flag to pass to the function would do as well? Something like "suppress_warnings=T" or similar?
I wonder if the issue is to do with the need to URL encode each of the query parameters, particularly filters and segments. In the ganalytics R package I addressed this using R's built-in URLencode
function but also by manually encoding '+
' characters as %2B
, as seen here in the form_url
function. I hope that helps.
Yep. Thx. Its working
@jdeboer Thanks for the assist. Let me test that out on my system.
@shahkushan1we have already disscused this
So am I understanding correctly that there is no way to bypass this error if you just want it to return zero results? I am looping through a series of URLs much like @slarty667 and sometimes it would naturally happen that, for example, a particular URL did not have any conversions over a given time period. Stopping my loop because no results were found is really an annoying feature.
@siemarie see a workaround I've used that I just posted in issue #8
Can you check your complete query with the Query Feed Explorer? If it works there, it will very likely work in R as well.