4

I'm making a report in Data Studio using my Analytics data, and I'm having some trouble finding out how to filter it. Here is what I need to do: I receive a "user" parameter in the URL, and I need to filter my "username" dimension with it. I want to make some kind of filter in the report, like Include usernameDimension = userParameter.

2
  • You should improve your answer. How are you passing parameters to your report? Are you using Report URL parameters and passing them in JSON format? (as explained in developers.google.com/datastudio/connector/…) Commented Jan 28, 2021 at 17:13
  • Yes I'm am! @DiegoQueiroz Commented Jan 29, 2021 at 15:11

2 Answers 2

17

For some limitation in DataStudio, currently it is not possible to directly use Report URL parameters for filtering reports (when you create a filter, it only allows you to select fields, not parameters). However, it is possible to 'hack' this limitation with a new field that references the parameter.

Create a new boolean field called my_filter (or something you wish) with this expression:

field_i_want_to_filter = my_parameter

Then, just create a new filter in your report using this field, with the condition my_filter is true.

Sign up to request clarification or add additional context in comments.

Comments

0

I can create a custom field to extract the username using a regular expressions.

Suppose you have a field called URL that contains something like:

https://example.com/path/path/endpoint?param1=blah&param2=bleh&username=Diego&param3=blih

You can use this formula in a new field to extract the username:

REGEXP_EXTRACT(URL, "[?&]username=([^&]*)")

You can easily add this custom field to a Drop down selector or something to allow filtering in your dashboard.

1 Comment

The URL comes from the embed, I already have it in a parameter. I don't want to put it in a dropdown, I need to compare it with the username dimension I already have, because it comes from the analytics.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.