---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/direct/doc/en/curl-ads-keywords-modify.md
  - https://yandex.com/dev/direct/doc/ru/curl-ads-keywords-modify.md
  - href: en/curl-ads-keywords-modify.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/examples/curl-ads-keywords-modify.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/direct/doc/en/llms.txt

# Add tags to an ad URL

Uses the cURL utility.

This example shows how to append custom tags to an ad URL. The tag values are specified in the `UserParam1` parameter for keywords using the [Keywords](https://yandex.com/dev/direct/doc/keywords/keywords.html).[update](https://yandex.com/dev/direct/doc/keywords/update.html) method. The tag is appended to the ad URL using the [Ads](https://yandex.com/dev/direct/doc/ads/ads.html).[update](https://yandex.com/dev/direct/doc/ads/update.html) method. You can use this method to pass data such as keyword IDs from your internal system or other attributes for tracking campaign performance.

To use the examples, change the input data to specify the OAuth token and the IDs of ads and keywords, and edit the URL. If you're submitting a request on behalf of an agency, be sure to include the client's login.

## Change keyword parameters

```bash translate=no
curl \
  -H 'Authorization: Bearer ТОКЕН' \
  -H 'Client-Login: ЛОГИН_КЛИЕНТА' \
  -d '{ "method": "update",
  "params": {
    "Keywords": [{
      "Id": ИДЕНТИФИКАТОР_ФРАЗЫ_1,
      "UserParam1": "ЗНАЧЕНИЕ_1"
    },
    {
      "Id": ИДЕНТИФИКАТОР_ФРАЗЫ_2,
      "UserParam1": "ЗНАЧЕНИЕ_2"
    }]
  }
}' https://api.direct.yandex.com/json/v501/keywords
```

## Add a parameter to the ad URL

```bash translate=no
curl \
  -H 'Authorization: Bearer ТОКЕН' \
  -H 'Client-Login: ЛОГИН_КЛИЕНТА' \
  -d '{ "method": "update",
  "params": {
    "Ads": [{
      "Id": ИДЕНТИФИКАТОР_ОБЪЯВЛЕНИЯ_1,
      "TextAd": {
        "Href": "https://www.site.com/1/?utm_source=yandex-direct&utm_term={param1}"
      }
    },
    {  
      "Id": ИДЕНТИФИКАТОР_ОБЪЯВЛЕНИЯ_2,
      "TextAd": {
        "Href": "https://www.site.com/2/?utm_source=yandex-direct&utm_term={param1}"
      }
    }]   
  }
}' https://api.direct.yandex.com/json/v501/ads
```

Result: The first link in the ad leads to `https://www.site.com/1/?utm_source=yandex-direct&utm_term=VALUE_1` when the ad is served for keyword 1, and to `https://www.site.com/1/?utm_source=yandex-direct&utm_term=VALUE_2` when the ad is served for keyword 2.

<!-- source: en/_includes/curl-bids/id-curl-bids/curl-win.md -->
{% note info %}

For cURL in Windows, replace all single quotes with double quotes, and escape double quotes in JSON code. For example: `-d "{\"method\"`...

{% endnote %}
<!-- endsource: en/_includes/curl-bids/id-curl-bids/curl-win.md -->
