> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# QuerySearchTermMetrics

# Package: googleAds

# Namespace: AnalyticsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/ads/google-ads/performance-metrics-v1/query-search-term-metrics.md

## Permission Scopes:
View google ads campaigns: SCOPE.PROMOTE.VIEW-GOOGLE-ADS

## Introduction

Retrieves a list of search terms that triggered a Smart campaign's ads, given the provided filtering and sorting.
Only supported for Smart campaigns. For Performance Max Leads campaigns, use [Query Search Term Metrics V2](https://dev.wix.com/docs/api-reference/business-management/marketing/ads/google-ads/performance-metrics-v1/query-search-term-metrics-v-2.md).

---

## REST API

### Schema

```
 Method: querySearchTermMetrics
 Description: Retrieves a list of search terms that triggered a Smart campaign's ads, given the provided filtering and sorting. Only supported for Smart campaigns. For Performance Max Leads campaigns, use [Query Search Term Metrics V2](https://dev.wix.com/docs/api-reference/business-management/marketing/ads/google-ads/performance-metrics-v1/query-search-term-metrics-v-2.md).
 URL: https://www.wixapis.com/_serverless/pa-google/v1/search-term-metrics
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  campaignResourceName
 Method parameters: 
   param name: campaignResourceName | type: campaignResourceName | description: Google Ads resource name of the Smart campaign to query, in the format `customers/{customerId}/campaigns/{campaignId}`. | required: true | validation: maxLength 1000
   param name: dateRange | type: DateRange | description: A date range used to filter analytics queries, either predefined or custom. | required: true 
    - ONE-OF: - required: true
     - name: custom | type: CustomDateRange | description: Custom date range.  
        - name: from | type: string | description: Start date, in `YYYY-MM-DD` format.  | validation: maxLength 20
        - name: to | type: string | description: End date, in `YYYY-MM-DD` format.  | validation: maxLength 20
     - name: predefined | type: PredefinedDateRange | description: Predefined date range.  
         - enum:
         -     UNSPECIFIED: Not specified.
         -     TODAY: Today only.
         -     YESTERDAY: Yesterday only.
         -     LAST_7_DAYS: The last 7 days not including today.
         -     LAST_BUSINESS_WEEK: The 5 day business week, Monday through Friday, of the previous business week.
         -     THIS_MONTH: All days in the current month.
         -     LAST_MONTH: All days in the previous month.
         -     LAST_14_DAYS: The last 14 days not including today.
         -     LAST_30_DAYS: The last 30 days not including today.
         -     THIS_WEEK_SUN_TODAY: The period between the previous Sunday and the current day.
         -     THIS_WEEK_MON_TODAY: The period between the previous Monday and the current day.
         -     LAST_WEEK_SUN_SAT: The 7-day period starting with the previous Sunday.
         -     LAST_WEEK_MON_SUN: The 7-day period starting with the previous Monday.
         -     LIFETIME: Since the beginning of the campaign.
   param name: paging | type: Paging | description: Paging information for an analytics query.  
        - name: nextPageToken | type: string | description: Token for retrieving the next page of results.  | validation: maxLength 100
        - name: pageSize | type: integer | description: Number of results to return.  
   param name: searchTermText | type: searchTermText | description: Filters results to search terms whose text contains this string. When omitted, all search terms are returned.  | validation: maxLength 1000
   param name: searchTermTextsFilter | type: SearchTermTextsFilter    
        - name: type | type: SearchTermTextFilterType | description: Whether to include or exclude search terms that match the provided list.  
             - enum:
             -     UNSPECIFIED: Unknown filter type. Do not use.
             -     MATCH: Return only search terms that appear in the provided list.
             -     NOT_MATCH: Return only search terms that do not appear in the provided list.
        - name: searchTermTexts | type: array<string> | description: Exact search term texts to filter by.  | validation: maxItems 1000, maxLength 1000
   param name: sort | type: SearchTermSorting    
        - name: field | type: SearchTermQueryFields | description: Metric field to sort by.  
             - enum:
             -     UNSPECIFIED: Unknown field. Do not use.
             -     IMPRESSIONS: Number of times the ad was shown for this search term.
             -     CLICKS: Number of clicks on the ad for this search term.
             -     COST: Total amount spent on ads triggered by this search term, in the account's currency.
             -     SEARCH_TERM: The search term text entered by the user.
        - name: order | type: SortOrder | description: Sort direction.  
             - enum:
             -     ASC: Ascending order.
             -     DESC: Descending order.
 Return type: QuerySearchTermMetricsResponse
  - name: results | type: array<SearchTermMetrics> | description: Per-search-term metric results for the requested page.  | validation: maxItems 1000
     - name: impressions | type: integer | description: Number of times the ad was shown for this search term.  | read-only: true 
     - name: clicks | type: integer | description: Number of clicks on the ad for this search term.  | read-only: true 
     - name: cost | type: number | description: Total amount spent on ads triggered by this search term, in the account's currency.  | read-only: true 
     - name: searchTerm | type: string | description: The search term text entered by the user that triggered the ad.  | read-only: true | validation: maxLength 1000
  - name: summaryRow | type: SearchTermMetrics | description: Aggregated totals across all search terms, not just the current page.  
  - name: nextPageToken | type: string | description: Token to pass in the next request to retrieve the following page of results.  | validation: maxLength 1000


```

### Examples

### Query search term metrics for a campaign
Retrieves search term metrics for a Google Ads campaign, filtered by date range and sorted by cost.

```curl
curl -X POST \
'https://www.wixapis.com/_serverless/pa-google/v1/search-term-metrics' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "campaignResourceName": "customers/3827461950/campaigns/7412836509",
  "searchTermText": "summer dress",
  "dateRange": {
    "custom": {
      "from": "2026-03-01",
      "to": "2026-03-31"
    }
  },
  "sort": {
    "field": "COST",
    "order": "DESC"
  },
  "paging": {
    "pageSize": 10
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.promoteGoogleAds.performanceMetrics.querySearchTermMetrics(campaignResourceName, options)
 Description: Retrieves a list of search terms that triggered a Smart campaign's ads, given the provided filtering and sorting. Only supported for Smart campaigns. For Performance Max Leads campaigns, use [Query Search Term Metrics V2](https://dev.wix.com/docs/api-reference/business-management/marketing/ads/google-ads/performance-metrics-v1/query-search-term-metrics-v-2.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  campaignResourceName
 Method parameters: 
   param name: campaignResourceName | type: string | description: Google Ads resource name of the Smart campaign to query, in the format `customers/{customerId}/campaigns/{campaignId}`. | required: true | validation: maxLength 1000
   param name: options | type: QuerySearchTermMetricsOptions  none  
        - name: searchTermText | type: string | description: Filters results to search terms whose text contains this string. When omitted, all search terms are returned.  | validation: maxLength 1000
        - name: searchTermTextsFilter | type: SearchTermTextsFilter | description: Filters results to an explicit list of search term texts. When combined with searchTermText, only terms matching both conditions are returned.  
           - name: type | type: SearchTermTextFilterType | description: Whether to include or exclude search terms that match the provided list.  
                 - enum:
                 -     UNSPECIFIED: Unknown filter type. Do not use.
                 -     MATCH: Return only search terms that appear in the provided list.
                 -     NOT_MATCH: Return only search terms that do not appear in the provided list.
           - name: searchTermTexts | type: array<string> | description: Exact search term texts to filter by.  | validation: maxItems 1000, maxLength 1000
        - name: dateRange | type: DateRange | description: Date range to query. When omitted, defaults to the campaign lifetime.  
           - ONE-OF: 
              - name: custom | type: CustomDateRange | description: Custom date range.  
                 - name: from | type: string | description: Start date, in `YYYY-MM-DD` format.  | validation: maxLength 20
                 - name: to | type: string | description: End date, in `YYYY-MM-DD` format.  | validation: maxLength 20
              - name: predefined | type: PredefinedDateRange | description: Predefined date range.  
                     - enum:
                     -     UNSPECIFIED: Not specified.
                     -     TODAY: Today only.
                     -     YESTERDAY: Yesterday only.
                     -     LAST_7_DAYS: The last 7 days not including today.
                     -     LAST_BUSINESS_WEEK: The 5 day business week, Monday through Friday, of the previous business week.
                     -     THIS_MONTH: All days in the current month.
                     -     LAST_MONTH: All days in the previous month.
                     -     LAST_14_DAYS: The last 14 days not including today.
                     -     LAST_30_DAYS: The last 30 days not including today.
                     -     THIS_WEEK_SUN_TODAY: The period between the previous Sunday and the current day.
                     -     THIS_WEEK_MON_TODAY: The period between the previous Monday and the current day.
                     -     LAST_WEEK_SUN_SAT: The 7-day period starting with the previous Sunday.
                     -     LAST_WEEK_MON_SUN: The 7-day period starting with the previous Monday.
                     -     LIFETIME: Since the beginning of the campaign.
        - name: sort | type: SearchTermSorting | description: Sorting to apply. Defaults to descending by cost when omitted.  
           - name: field | type: SearchTermQueryFields | description: Metric field to sort by.  
                 - enum:
                 -     UNSPECIFIED: Unknown field. Do not use.
                 -     IMPRESSIONS: Number of times the ad was shown for this search term.
                 -     CLICKS: Number of clicks on the ad for this search term.
                 -     COST: Total amount spent on ads triggered by this search term, in the account's currency.
                 -     SEARCH_TERM: The search term text entered by the user.
           - name: order | type: SortOrder | description: Sort direction.  
                 - enum:
                 -     ASC: Ascending order.
                 -     DESC: Descending order.
        - name: paging | type: Paging | description: Paging to apply.  
           - name: nextPageToken | type: string | description: Token for retrieving the next page of results.  | validation: maxLength 100
           - name: pageSize | type: integer | description: Number of results to return.  
 Return type: PROMISE<QuerySearchTermMetricsResponse>
  - name: results | type: array<SearchTermMetrics> | description: Per-search-term metric results for the requested page.  | validation: maxItems 1000
     - name: impressions | type: integer | description: Number of times the ad was shown for this search term.  | read-only: true 
     - name: clicks | type: integer | description: Number of clicks on the ad for this search term.  | read-only: true 
     - name: cost | type: number | description: Total amount spent on ads triggered by this search term, in the account's currency.  | read-only: true 
     - name: searchTerm | type: string | description: The search term text entered by the user that triggered the ad.  | read-only: true | validation: maxLength 1000
  - name: summaryRow | type: SearchTermMetrics | description: Aggregated totals across all search terms, not just the current page.  
  - name: nextPageToken | type: string | description: Token to pass in the next request to retrieve the following page of results.  | validation: maxLength 1000


```

### Examples

### Query search term metrics for a campaign
```javascript
import { performanceMetrics } from '@wix/promote-google-ads';

async function querySearchTermMetrics() {
  const response = await performanceMetrics.querySearchTermMetrics(
    'customers/3827461950/campaigns/7412836509',
    {
      searchTermText: 'summer dress',
      dateRange: {
        custom: {
          from: '2026-03-01',
          to: '2026-03-31',
        },
      },
      sort: {
        field: 'COST',
        order: 'DESC',
      },
      paging: {
        pageSize: 10,
      },
    },
  );
}

/* Promise resolves to:
 * {
 *   "results": [
 *     {
 *       "searchTerm": "summer dress sale",
 *       "impressions": 4821,
 *       "clicks": 338,
 *       "cost": 142.56
 *     },
 *     {
 *       "searchTerm": "summer floral dress",
 *       "impressions": 3104,
 *       "clicks": 217,
 *       "cost": 91.34
 *     }
 *   ],
 *   "summaryRow": {
 *     "searchTerm": "",
 *     "impressions": 7925,
 *     "clicks": 555,
 *     "cost": 233.90
 *   },
 *   "nextPageToken": "CAoQAA"
 * }
 */

```

### querySearchTermMetrics (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { performanceMetrics } from '@wix/promote-google-ads';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { performanceMetrics },
  // Include the auth strategy and host as relevant
});


async function querySearchTermMetrics(campaignResourceName,options) {
  const response = await myWixClient.performanceMetrics.querySearchTermMetrics(campaignResourceName,options);
};
```

---