필터링
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
filters
쿼리 문자열 매개변수는 반환되는 데이터를 제한합니다.
애드센스 관리 API 보고서에 표시됩니다. filters
매개변수를 사용하면
필터링할 측정기준과 필터 표현식을 제공합니다.
필터링된 쿼리는 결과에 포함될 행을 제한합니다. 각 행
필터에 대해 결과가 테스트됩니다. 필터가 일치하면 행은
일치하지 않으면 행이 삭제됩니다.
- URL 인코딩: 클라이언트 라이브러리가 자동으로
살펴보겠습니다. 그러나 프로토콜에 직접 요청을 수행하면
아래 표에 표시된 대로 필터 연산자를 명시적으로 인코딩해야 합니다.
- 필터링 우선순위: 필터링은 측정기준의 이전에 실행됩니다.
반환된 측정항목은
생성할 수 있습니다.
필터 구문
단일 필터는 다음 형식을 사용합니다.
name operator expression
이 구문에서 각 항목의 의미는 다음과 같습니다.
- name — 필터링할 측정기준의 이름입니다.
예:
AD_CLIENT_ID
는 광고 클라이언트 ID를 필터링합니다.
- operator - 사용할 필터링 일치 유형을 정의합니다.
- expression - 결과에 포함할 값을 지정합니다.
타겟팅하려는 모든 측정기준
필터로 사용할 수 있으며,
날짜 관련 측정기준 (DATE
, WEEK
,
및 MONTH
) 날짜별로 필터링하려면
보고서 기간을 대신 사용할 수 있습니다.
필터 연산자
필터 연산자에는 두 가지가 있습니다. 연산자는 다음과 같이 URL로 인코딩되어야 합니다.
URL 쿼리 문자열에 포함되어야 합니다.
연산자 |
설명 |
URL 인코딩 형식 |
예 |
== |
일치검색 |
%3D%3D |
국가명이 Canada인 측정항목을 집계합니다.
<ph type="x-smartling-placeholder"> </ph>
filters=COUNTRY_NAME%3D%3DCanada |
=@ |
하위 문자열 포함 |
%3D@ |
국가명이 United인 측정항목을 집계합니다.
예를 들어 미국 및 영국과 일치합니다.
<ph type="x-smartling-placeholder"> </ph>
filters=COUNTRY_NAME%3D@United |
필터 표현식
필터 표현식에는 몇 가지 중요한 규칙이 있습니다.
- URL 예약 문자 —
&
는 일반적인 방식으로 URL 인코딩되어야 합니다. 클라이언트 라이브러리
이 인코딩에 대해 걱정할 필요는 없습니다.
프로토콜을 직접 호출합니다.
- 예약 문자 — 쉼표와 백슬래시는
백슬래시로 이스케이프 처리되어야 합니다.
참고: 뒤에 백슬래시를 이스케이프 처리해야 합니다.
쉼표를 사용합니다.
필터 결합
OR
및 AND
부울을 사용하여 필터를 결합할 수 있습니다.
제공합니다.
OR 로직
OR
논리는 쉼표 (,
)를 사용하여
필터 표현식입니다.
예: (각각을 URL 인코딩해야 함)
국가 코드가 US 또는 UK인 경우:
COUNTRY_CODE==US,COUNTRY_CODE==UK
AND 로직
AND
논리는 여러 필터 매개변수를 제공하여 실행되며,
클라이언트 라이브러리에 필터 배열을 제공하는 것으로 변환됩니다.
예:
국가 코드가 US이고 제품 코드가 AFC인 경우:
filters=COUNTRY_CODE%3D%3DUS&filters=PRODUCT_CODE%3D%3DAFC
AND 및 OR 로직 결합
하나의 표현식에 AND 및 OR 로직을 결합할 수 있습니다.
참고: 각 필터는 개별적으로 평가됩니다.
로 표현해야 합니다.
예:
국가 코드가 US 또는 UK이고 제품 코드가 AFC인 경우:
filters=COUNTRY_CODE%3D%3DUS,COUNTRY_CODE%3D%3DUK&filters=PRODUCT_CODE%3D%3DAFC
다음 단계
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 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)"]]