Skip to content

[ENH] Add ability to enforce specific filter on Google Analytics query #8806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

manugarri
Copy link

Fix for #3505

This PR allows to directly write filters to ga.py read_ga function.

Currently only OR filters are supported. with this PR we can support directly writing the filters as a string, allowing for example AND filtering.

Example here

example

@jreback
Copy link
Contributor

jreback commented Nov 13, 2014

It seems that you can already do this, by simply specifying the filters as a compound string, no?

have multiple keywords for this does not seem like a good idea.

Further, this needs tests (well the entire module needs some tests, against a mock GA).

@manugarri
Copy link
Author

So currently you can only add filters that get added with a comma separating them (see https://github.com/pydata/pandas/blob/master/pandas/io/ga.py#L386).

comma separated filters are interpreted as being added with an OR. The Google analytics way of adding an AND to the filters is by adding the filter with a semicolon separating them.

My implementation doesn't affect the current API (afaik), and allows anyone with more specific filtering needs to write a custom filter.

@jreback
Copy link
Contributor

jreback commented Nov 14, 2014

and is their anything stopping you from simply passing the entire correct string as the filter argument?

@manugarri
Copy link
Author

ok, so just noticed that my implementation was a totla overkill.

you can just send the raw_filter as filter = ['filter1;ga:filter2,ga:filter3...]

Will close

@manugarri manugarri closed this Nov 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants