In Facebook marketing API, where to set target URL of an Ad Campaign

2.2k views Asked by At

I would like to create an Ad Campaign with the Marketing API but I don't know where I can set the target URL of this campaign.

I can set the objective of the campaign to WEBSITE_CLICKS but where to set the URL it will goes to?

If I use the Web Ads Manager, when I click create campaign and select the objective of "web site click", then I have to enter the promoted URL. But with the API I don't find where I can set this.

Thanks,

Julien

2

There are 2 answers

0
Julien Bachmann On BEST ANSWER

I finally found where I can find the promoted URL of my Ad.

In fact when you generate your Ad through the Web Ad Manager it will create a hidden post on the Facebook page that is used for the Ad (see this blog post). And Ad creative use an object_story_id and object_story_spec to link to it. So I can find my link in the field 'object_story_spec' of the creative.

->/v2.3/6024899447563/adcreatives?fields=object_story_spec
result:
{
  "data": [
    {
      "object_story_spec": {
        "page_id": "1574237802836192", 
        "link_data": {
          "link": "http://www.mylink.com/destination", 
          "message": "Click!", 
          "name": "My test", 
          "description": " ", 
          "image_hash": "9b25eba026f1ad716010963db25fabb8", 
          "multi_share_optimized": false
        }
      }, 
      "id": "6024899447563"
    }
  ], 
  "paging": {
    "cursors": {
      "before": "NjAyNDg5ODQ0ODE2Mg==", 
      "after": "NjAyNDg5OTU0ODE2Mg=="
    }
  }
}

So the link is in object_story_spec.link_data.link of the creative of the Ad.

1
Colin Smillie On

The Ad Set Object can contain an Promotion Object:

https://developers.facebook.com/docs/marketing-api/adset#promoted_object

Or it can be contained in the Ad Creative as a link_url:

https://developers.facebook.com/docs/marketing-api/adcreative/v2.3

If Campaign Object has the objective set ( which is optional ), ad sets and ad creative will be validated against the objective.

You may also need to query connection objects, especially if you want a specific Facebook Page or Tab:

https://developers.facebook.com/docs/marketing-api/connectionobjects/v2.3