how to do dimentsion filter dynamically?

Dec 22, 2014 at 4:31 PM
Edited Dec 22, 2014 at 4:31 PM
Hi,

I am trying to send adwords customer ID dimension filter but I cant figure out how can I do this using a variable? how to pass it through an experssion? for example: profileId, I can pass as shown below, how about the dimension filter?

http://postimg.org/image/uezpxbwq5/

thanks,
Feb 4, 2015 at 11:20 PM
Edited Feb 4, 2015 at 11:25 PM
You'll need to do a few of things:-
  1. Declare a string variable/parameter in the package (say paramDimensionFilters).
  2. Set the value of this variable/param programmatically by building a string in this format::
    <dimension> <operator> <value> and then assign this value to the variable/param.
    e.g if I wanted to filter the SourceMedium dimension for the value "Google", the assignment would look like
    paramDimensionFilter = "ga:sourceMedium == Google" (include the quotes)
  3. assign the paramDimensionFilter to the "DimensionFilters" property of the GA adapter via an expression, just like any other expression value.
You can set any value for paramDimensionFilter manually or programmatically at run time and it'll reflect that in the call to the GA reporting API once the adapter submits the query to GA.

P.S: here is a link to the various operators that are available for GA filters (dimensions and metrics) and how they translate:
https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filterSyntax

Hope this helps.

Cheers!
Muqadder.
Apr 13, 2015 at 3:31 PM
I haven't been able to get the dimensions filter to work properly. I have a few API calls that utilize the dimensions filter. The SSIS package fails on the Pre-Execute phase when I attempt to use more than one filter criteria. Based on Google's dev guide, multiple filters can be separated by a comma or a semicolon depending on OR or AND criteria.

I've been able to do some troubleshooting, just using one criteria and I have found in that case, the package does not fail, however, when the job runs, the Dimensions Filter is ignored and is not appended on to the API call. Screenshot: http://www.screencast.com/t/GYfnaoAqafp6

Let me, please, if you have any thoughts or suggestions on how to get dimensions to work. I've tried both ways using a variable and hard coding it in.