[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003efilters\u003c/code\u003e query string parameter limits the data returned in an AdSense Management API report, allowing you to filter by dimension using operators and expressions.\u003c/p\u003e\n"],["\u003cp\u003eFiltering happens before aggregation, ensuring metrics reflect only the relevant dimensions.\u003c/p\u003e\n"],["\u003cp\u003eFilter expressions use operators like \u003ccode\u003e==\u003c/code\u003e for exact match and \u003ccode\u003e=@\u003c/code\u003e for substring match, requiring URL encoding for direct protocol calls.\u003c/p\u003e\n"],["\u003cp\u003eFilters can be combined using comma (\u003ccode\u003e,\u003c/code\u003e) for \u003ccode\u003eOR\u003c/code\u003e logic within a single filter parameter and multiple filter parameters for \u003ccode\u003eAND\u003c/code\u003e logic.\u003c/p\u003e\n"],["\u003cp\u003eDate filtering is done by specifying the date range for the report instead of using date-related dimensions in the \u003ccode\u003efilters\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],["The `filters` parameter in the AdSense Management API refines report data by specifying dimensions and filter expressions. Filtering happens before aggregation, ensuring metrics represent only relevant dimensions. Filters use the syntax `name operator expression`, with `==` for exact matches and `=@` for substring containment. Multiple filters can be combined using `OR` (commas within a filter) and `AND` (multiple filter parameters), allowing complex logic. Date-related dimensions cannot be used, but escaping rules must be followed.\n"],null,["# Filtering\n\nThe `filters` query string parameter restricts the data returned\nin an AdSense Management API report. When you use the `filters` parameter, you\nsupply a dimension you want to filter on, followed by the filter expression.\n\nFiltered queries restrict the rows that get included in the result. Each row\nin the result is tested against the filter: if the filter matches, the row is\nretained and if it doesn't match, the row is dropped.\n\n- **URL Encoding**: The client libraries automatically encode the filter operators. However, if you make requests directly to the protocol, you must explicitly encode filter operators as indicated in the table below.\n- **Filtering priority** : Filtering occurs *before* any dimensions are aggregated, so that the returned metrics represent the total for only the relevant dimensions.\n\nFilter Syntax\n-------------\n\nA single filter uses the form: \n\n```\nname operator expression\n```\n\nIn this syntax:\n\n- *name* --- the name of the dimension on which to filter. For example: `AD_CLIENT_ID` will filter on the ad client ID.\n- *operator* --- defines the type of filter match to use.\n- *expression* --- states the values included in the results.\n\nAll [dimensions](/adsense/management/metrics-dimensions) that\napply to the metrics being reported on can be used as filters, with the\nexception of the date-related dimensions (`DATE`, `WEEK`,\nand `MONTH`). To filter by date, [specify the\ndate range for the report](/adsense/management/reporting/date_ranges) instead.\n\nFilter Operators\n----------------\n\nThere are two filter operators. The operators must be URL encoded in order to\nbe included in URL query strings.\n\n\u003cbr /\u003e\n\n| Operator | Description | URL Encoded Form | Example |\n|----------|--------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `==` | Exact match | `%3D%3D` | Aggregate metrics where the country name is *Canada* : `filters=COUNTRY_NAME%3D%3DCanada` |\n| `=@` | Contains substring | `%3D@` | Aggregate metrics where the country name contains *United* , this matches United States and United Kingdom for example: `filters=COUNTRY_NAME%3D@United` |\n\n\u003cbr /\u003e\n\nFilter Expressions\n------------------\n\nThere are a couple of important rules for filter expressions:\n\n- **URL-reserved characters** --- Characters such as `&` must be url-encoded in the usual way. Client libraries take care of this for you, so you only have to worry about this encoding if you are making direct calls to the protocol.\n- **Reserved characters** --- The comma and backslash must be backslash escaped when they appear in an expression.\n - backslash `\\\\`\n - comma `\\,`\n\n**Note:**Make sure you escape backslashes before\ncommas, in order to avoid double escaping.\n\nCombining Filters\n-----------------\n\nFilters can be combined using `OR` and `AND` boolean\nlogic.\n\n### OR logic\n\n`OR` logic is defined using a comma (`,`) inside the\nfilter expression. \n**Example:** *(each must be URL encoded)*\n\n\nCountry code is either (US OR UK): \n\n`COUNTRY_CODE==US,COUNTRY_CODE==UK`\n\n### AND logic\n\n`AND` logic is achieved by providing multiple filter parameters,\nwhich translates into providing an array of filters in the client libraries. \n**Example:**\n\nCountry code is US AND product code is AFC: \n\n`filters=COUNTRY_CODE%3D%3DUS&filters=PRODUCT_CODE%3D%3DAFC`\n\n### Combining AND and OR logic\n\nIt's possible to combine AND and OR logic into a single expression.\n\n**Note:**Each filter is evaluated individually\nbefore all filters are combined into an AND logical expression. \n**Example:**\n\nCountry code is (US OR UK) AND product code is AFC: \n\n`filters=COUNTRY_CODE%3D%3DUS,COUNTRY_CODE%3D%3DUK&filters=PRODUCT_CODE%3D%3DAFC`\n\nNext steps\n----------\n\n- [Choosing the Right Dimension](/adsense/management/reporting/right_dimension)\n- [Running Large Reports](/adsense/management/reporting/large_reports)\n- [List of Metrics and Dimensions](/adsense/management/metrics-dimensions)"]]