targetingURL

Target campaign placement on the site by URL.

This type of targeting is convenient if you need to show ads on specific site pages or prohibit impressions on certain pages.

Request format

https://adfox.yandex.com/api/v1
  ? object=campaign
  & action=targetWebsite
  & actionObject=targetingURL
  & objectID=<integer>
  & siteID=<integer>
  & isRedefined=<integer>
  & [templateType=<integer>]
  & [targetingUrlOn[]=<string>]
  & [targetingUrlOff[]=<string>]

objectID*

ID of the object the action applies to.

siteID*

Site ID.

isRedefined*

Redefine targeting.

Acceptable values:

  • 0: Inherit targeting settings from a higher level. Level hierarchy from top to bottom:

    • Campaign.
    • Campaign on the site.
    • Campaign in the site section.
    • Campaign on the placement.
    • Banner.
  • 1: Cancel targeting settings from higher levels and use the parameters set at the current level.

templateType

Template type for targeting by URL.

Acceptable values:

  • 0: Standard. In the URL template, use the * symbol for a sequence of any characters of any length.
  • 1: POSIX. In the URL template, use regular expressions according to the POSIX standard.

Default value: 0.

targetingUrlOn[]

The URL of the page where ad serving is allowed.

If there are multiple URLs, every URL must be passed in a separate parameter. The maximum number of parameters with a URL is 5.

Example
targetingUrlOn[]=url1&targetingUrlOn[]=url2...

targetingUrlOff[]

URL of the page where ad serving is prohibited.

If there are multiple URLs, every URL must be passed in a separate parameter. The maximum number of parameters with a URL is 5.

Example
targetingUrlOff[]=url1&targetingUrlOff[]=url2...

Response format

<response>
  <status>
    <code>{integer}</code>
  </status>
</response>

Response parameters

code

Request processing status. A value of 0 means the request was completed successfully. For the key, see Error handling.

Sample request and response

Request:

https://adfox.yandex.com/api/v1?object=campaign&action=targetWebsite&actionObject=targetingURL&objectID=474205&siteID=321&isRedefined=1&templateType=0&targetingUrlOn[]=*site.com/&targetingUrlOn[]=*site.com/*&targetingUrlOff[]=https://www.demo.site.com/*

Response:

<response>
  <status>
    <code>0</code>
  </status>
</response>

Other actions with the object

Read more about other actions with the campaign object:

ID of the object the action applies to.

Site ID.

Redefine targeting.

Acceptable values:

  • 0: Inherit targeting settings from a higher level. Level hierarchy from top to bottom:

    • Campaign.
    • Campaign on the site.
    • Campaign in the site section.
    • Campaign on the placement.
    • Banner.
  • 1: Cancel targeting settings from higher levels and use the parameters set at the current level.

Template type for targeting by URL.

Acceptable values:

  • 0: Standard. In the URL template, use the * symbol for a sequence of any characters of any length.
  • 1: POSIX. In the URL template, use regular expressions according to the POSIX standard.

Default value: 0.

The URL of the page where ad serving is allowed.

If there are multiple URLs, every URL must be passed in a separate parameter. The maximum number of parameters with a URL is 5.

Example
targetingUrlOn[]=url1&targetingUrlOn[]=url2...

URL of the page where ad serving is prohibited.

If there are multiple URLs, every URL must be passed in a separate parameter. The maximum number of parameters with a URL is 5.

Example
targetingUrlOff[]=url1&targetingUrlOff[]=url2...

Required parameter.