Iklan Aplikasi

Dokumen ini mendeskripsikan berbagai unit iklan yang dirancang untuk mendorong instalasi dan interaksi untuk aplikasi desktop dan seluler.

Anda harus menggunakan unit iklan ini untuk mengarahkan orang ke desktop atau aplikasi seluler Anda untuk tujuan instalasi atau interaksi menggunakan foto, video, carousel, atau Materi iklan yang bisa diputar.

Secara konseptual, ini memungkinkan untuk iklan berikut:

Foto Video Carousel Bisa Diputar

Iklan Instalasi Seluler

Iklan Interaksi Seluler

Iklan Instalasi Desktop

Iklan Interaksi Desktop

Iklan Aplikasi Desktop untuk Barang Virtual

Iklan aplikasi desktop untuk barang virtual adalah bagian dari interaksi desktop, Anda dapat menggunakan penawaran barang virtual untuk berinteraksi kembali dengan pemain agar kembali ke aplikasi Anda. Contoh: aplikasi dapat menawarkan diskon untuk item atau satu set mata uang dalam-aplikasi di beranda untuk berinteraksi kembali dengan pembeli lama. Lihat di sini untuk petunjuk tentang cara menyiapkan aplikasi Anda untuk menerima pembayaran.

Sebagai referensi, seperti inilah tampilan unit gambar instalasi seluler:

Seperti inilah tampilan iklan aplikasi desktop untuk barang virtual dengan gambar

Prasyarat

  • Untuk membuat iklan aplikasi, developer aplikasi harus menyelesaikan langkah-langkah dalam tutorial ini.
  • Pengiklan harus memiliki Halaman Facebook untuk menjalankan iklan ini.

Membuat

Ketika membuat iklan, perhatikan persyaratan berikut:

  • Tujuan Kampanye harus berupa APP_INSTALLS, LINK_CLICKS, atau CONVERSIONS.
  • Untuk iklan aplikasi seluler, kami mewajibkan penggunaan kolom user_os. spesifikasi penargetan seluler. Penempatan harus memiliki kolom device_platforms dengan nilai ["mobile"] dan sangat direkomendasikan untuk menggunakan kolom spesifikasi lainnya guna menargetkan perangkat seluler di Facebook. Secara opsional, Anda dapat menentukan publisher_platforms jika Anda hanya menginginkan platform tertentu.
  • Untuk iklan aplikasi canvas, device_platforms harus berupa desktop. Secara opsional, Anda dapat menentukan facebook_positions jika Anda tidak menginginkan kolom Kabar dan kolom Sisi Kanan desktop Facebook.
  • Saat GET_OFFER digunakan untuk barang virtual, harga harus didiskon. Lihat barang virtual untuk informasi selengkapnya.

Ajakan bertindak Iklan Aplikasi:

Ajakan bertindak tambahan di bawah ini tersedia untuk iklan aplikasi di dalam kolom call_to_actionpostingan atau object_story_spec materi iklan. Anda juga dapat menentukan tautan dalam aplikasi seluler di kolom app_link, atau objek barang virtual aplikasi desktop di kolom product_link.

Kode Nilai Wajib

type

Jenis ajakan bertindak untuk seluler, terlepas dari instalasi atau interaksi:
SHOP_NOW
BOOK_TRAVEL
LEARN_MORE
SIGN_UP
DOWNLOAD
INSTALL_MOBILE_APP
USE_MOBILE_APP
WATCH_VIDEO
WATCH_MORE
OPEN_LINK
Jenis ajakan bertindak untuk instalasi atau interaksi desktop:
USE_APP (aplikasi desktop)
PLAY_GAME (aplikasi game desktop)
Jenis ajakan bertindak untuk iklan aplikasi desktop untuk barang virtual:
BUY_NOW
GET_OFFER

ya

value

kamus JSON dari: {"link": "<APP_STORE_LINK>","app_link": "<MOBILE_DEEP_LINK>","product_link": "<VIRTUAL_GOOD_DEEP_LINK>","link_title": "<NAME_FOR_LINK>"}

ya

  • Hanya nilai tertentu yang diperlukan

value.link

merujuk ke App Store, Google Play Store, atau URL Aplikasi Canvas Facebook, misal: https://itunes.apple.com/us/app/facebook/id284882215

ya

value.app_link

Untuk mendefinisikan destinasi tautan dalam hanya untuk aplikasi seluler, misal: myapp://product/12345. Untuk menentukan tautan dalam untuk aplikasi desktop, Anda harus menentukannya langsung di kolom tautan URL.

ya, hanya untuk instalasi seluler atau iklan interaksi

value.product_link

Untuk menentukan URL yang mengarah ke objek barang virtual Graf Terbuka produk. Lihat di sini untuk detail penyiapannya.

ya, hanya untuk barang virtual desktop

value.link_title

Mengizinkan Anda menyesuaikan nama untuk tautan, yang muncul di bawah gambar iklan

tidak

Spesifikasi kolom

Membuat dengan Foto

Untuk membuat iklan desktop atau aplikasi seluler dengan foto, pertama-tama buat Postingan Halaman tautan dengan foto menggunakan kolom object_story_spec: {'link_data': ...} materi iklan.

Contoh:

curl -X POST \
  -F 'name="Sample Creative"' \
  -F 'object_story_spec={
       "page_id": "<PAGE_ID>",
       "link_data": {
         "call_to_action": {
           "type": "INSTALL_MOBILE_APP",
           "value": {
             "link": "<APP_STORE_URL>"
           }
         },
         "image_hash": "<IMAGE_HASH>",
         "link": "<APP_STORE_URL>",
         "message": "Try it out"
       }
     }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives

Alternatifnya, Anda dapat membuat Postingan Halaman melalui endpoint beranda halaman itu dan menggunakan ID postingan di materi iklan. Lihat bagian contoh di bawah untuk contoh lainnya.

Untuk membuat iklan interaksi atau penginstalan aplikasi seluler menggunakan format iklan carousel, ikuti petunjuk di dokumen iklan carousel kecuali di kolom link masing-masing child_attachments, tentukan tautan toko aplikasi.

Pertimbangan

  • Saat ini iklan aplikasi seluler carousel hanya mendukung satu aplikasi
  • Jumlah minimum 3 gambar (vs. 2 pada iklan carousel iklan non-aplikasi)
  • Iklan aplikasi seluler carousel harus memiliki ajakan bertindak yang ditentukan
  • Kartu akhir (biasanya menampilkan foto profil Halaman) tidak akan ditampilkan untuk iklan aplikasi seluler carousel.

Perhatikan bahwa Anda harus menentukan tautan toko aplikasi yang sama di masing-masing child_attachment. Anda tidak perlu menentukan tautan lagi di call_to_action:{'value':{'link':... }}}

curl -X POST \
  -F 'name="Carousel app ad"' \
  -F 'object_story_spec={
       "page_id": "<PAGE_ID>",
       "link_data": {
         "message": "My message",
         "link": "http://www.example.com/appstoreurl",
         "caption": "WWW.ITUNES.COM",
         "name": "The link name",
         "description": "The link description",
         "child_attachments": [
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           },
           {
             "link": "http://www.example.com/appstoreurl",
             "image_hash": "<IMAGE_HASH>",
             "call_to_action": {
               "type": "USE_MOBILE_APP",
               "value": {
                 "app_link": "<DEEP_LINK>"
               }
             }
           }
         ],
         "multi_share_optimized": true
       }
     }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives

Membuat dengan Video

Untuk membuat iklan aplikasi dengan video, pertama-tama unggah video ke galeri video akun iklan. Lalu gunakan ID video ID di kolom object_story_spec: {'video_data':...} materi iklan.

Contoh:

use FacebookAds\Object\AdCreative;
use FacebookAds\Object\AdCreativeVideoData;
use FacebookAds\Object\Fields\AdCreativeVideoDataFields;
use FacebookAds\Object\AdCreativeObjectStorySpec;
use FacebookAds\Object\Fields\AdCreativeObjectStorySpecFields;
use FacebookAds\Object\Fields\AdCreativeFields;

$video_data = new AdCreativeVideoData();
$video_data->setData(array(
  AdCreativeVideoDataFields::IMAGE_URL => '<THUMBNAIL_URL>',
  AdCreativeVideoDataFields::VIDEO_ID => <VIDEO_ID>,
  AdCreativeVideoDataFields::CALL_TO_ACTION => array(
    'type' => 'INSTALL_MOBILE_APP',
    'value' => array(
      'link' => '<APP_STORE_URL>',
    ),
  ),
));

$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
  AdCreativeObjectStorySpecFields::PAGE_ID => <PAGE_ID>,
  AdCreativeObjectStorySpecFields::VIDEO_DATA => $video_data,
));

$creative = new AdCreative(null, 'act_<AD_ACCOUNT_ID>');

$creative->setData(array(
  AdCreativeFields::NAME => 'Sample Creative',
  AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));

$creative->create();
from facebookads.adobjects.adcreative import AdCreative
from facebookads.adobjects.adcreativeobjectstoryspec \
    import AdCreativeObjectStorySpec
from facebookads.adobjects.adcreativevideodata \
    import AdCreativeVideoData

video_data = AdCreativeVideoData()
video_data[AdCreativeVideoData.Field.description] = 'try it out'
video_data[AdCreativeVideoData.Field.video_id] = <VIDEO_ID>
video_data[AdCreativeVideoData.Field.image_url] = '<THUMBNAIL_URL>'
video_data[AdCreativeVideoData.Field.call_to_action] = {
    'type': 'INSTALL_MOBILE_APP',
    'value': {
        'link': '<APP_STORE_URL>',
        'link_title': 'Facebook',
    },
}

object_story_spec = AdCreativeObjectStorySpec()
object_story_spec[AdCreativeObjectStorySpec.Field.page_id] = <PAGE_ID>
object_story_spec[AdCreativeObjectStorySpec.Field.video_data] = video_data

creative = AdCreative(parent_id='act_<AD_ACCOUNT_ID>')
creative[AdCreative.Field.name] = 'Sample Creative'
creative[AdCreative.Field.object_story_spec] = object_story_spec
creative.remote_create()
AdCreative adCreative = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdCreative()
  .setName("Sample Creative")
  .setObjectStorySpec(
    new AdCreativeObjectStorySpec()
      .setFieldPageId(<PAGE_ID>)
      .setFieldVideoData(
        new AdCreativeVideoData()
          .setFieldCallToAction(
            new AdCreativeLinkDataCallToAction()
              .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_INSTALL_MOBILE_APP)
              .setFieldValue(
                new AdCreativeLinkDataCallToActionValue()
                  .setFieldLink(<APP_STORE_URL>)
              )
          )
          .setFieldLinkDescription("try it out")
          .setFieldImageUrl(<THUMBNAIL_URL>)
          .setFieldVideoId(<VIDEO_ID>)
      )
  )
  .execute();
String ad_creative_id = adCreative.getId();
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": { 
      "call_to_action": {"type":"INSTALL_MOBILE_APP","value":{"link":"<APP_STORE_URL>"}}, 
      "image_url": "<THUMBNAIL_URL>", 
      "video_id": "<VIDEO_ID>" 
    } 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

Alternatifnya, Anda dapat membuat Postingan Halaman melalui endpoint video halaman dan menggunakan ID video dalam materi iklan. Lihat bagian contoh di bawah untuk contoh lainnya.

Membaca

Untuk mendapatkan detail tentang Postingan Halaman Anda, baca dokumen postingan halaman tautan atau dokumen postingan halaman video.

Anda dapat membuat daftar semua Postingan Halaman dari edge /promotable_posts halaman itu.

curl https://graph.facebook.com/{API_VERSION}/{PAGE_ID}/promotable_posts

Untuk mendapatkan detail tentang materi iklan Anda, baca dokumentasi materi iklan.

Sebelum Memulai

Contoh Kode

"call_to_action={'type':'LEARN_MORE', 'value':{'link':'https://itunes.apple.com/us/app/facebook/id284882215', 'app_link':'facebook://path/to/page'}}"

Sebelum menentukan tautan aplikasi, Anda harus memvalidasi bahwa itu telah dihapus dengan memanggil:

https://graph.facebook.com/{API_VERSION}/?type=og&amp;scrape=true&amp;id={APP_LINK}

Insight Aplikasi Seluler

Insight hanya berlaku untuk iklan dengan objek yang dipromosikan berisi ID aplikasi. Untuk mendapatkan ID aplikasi, daftarkan aplikasi di Facebook.

Meta akan memberikan insight harian agregat tentang demografi orang-orang yang menginstal aplikasi Anda. Untuk mengambilnya, Anda harus menggunakan token dan kueri akses aplikasi

https://graph.facebook.com/{API_VERSION}/{APP_ID}/insights/application_mobile_app_installs?&access_token={ACCESS_TOKEN}

Anda juga dapat memerinci statistik dengan menentukan parameter URL tambahan, breakdown, sama dengan salah satu nilai berikut. Saat ini Anda tidak dapat menggabungkan perincian.

Nama Deskripsi

gender_age

Perinci statistik Anda tentang usia dan jenis kelamin pemirsa

country

Perinci statistik Anda tentang negara pemirsa

locale

Perinci statistik Anda tentang bahasa pemirsa

Contoh:

https://graph.facebook.com/{API_VERSION}/{APP_ID}/insights/application_mobile_app_installs?breakdown=gender_age&amp;access_token={ACCESS_TOKEN}

https://graph.facebook.com/{API_VERSION}/{APP_ID}/insights/application_mobile_app_installs?breakdown=country&amp;access_token={ACCESS_TOKEN}

https://graph.facebook.com/{API_VERSION}/{APP_ID}/insights/application_mobile_app_installs?breakdown=locale&amp;access_token={ACCESS_TOKEN}

Contoh

Membuat iklan gambar penginstalan aplikasi seluler

Langkah 1. Buat Postingan Halaman dengan gambar. Perhatikan bahwa Anda harus menggunakan PAGE_ACCESS_TOKEN dan sesi Pages API untuk membuat Postingan Halaman.

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$params = array(
  'message' => 'Sign up today',
  'picture' => '<IMAGE_URL>',
  'link' => '<LINK>',
  'published' => 1,
  'call_to_action' => array(
    'type' => 'SIGN_UP',
    'value' => array(
      'link' => '<LINK>',
    ),
  ),
);

$data = Api::instance()->call(
  '/'.<PAGE_ID>.'/feed',
  RequestInterface::METHOD_POST,
  $params)->getContent();
from facebookads import FacebookAdsApi

params = {
    'massage': 'Sign up today.',
    'picture': '<IMAGE_URL>',
    'link': '<LINK>',
    'published': 1,
    'call_to_action': {
        'type': 'SIGN_UP',
        'value': {
            'link': '<LINK>',
        },
    },
}

data = FacebookAdsApi.get_default_api().\
    call('POST', (<PAGE_ID>, 'feed'), params=params)
curl \
  -F 'message=Sign up today' \
  -F 'picture=<IMAGE_URL>' \
  -F 'link=<LINK>' \
  -F 'published=1' \
  -F 'call_to_action={"type":"SIGN_UP","value":{"link":"<LINK>"}}' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PAGE_ID>/feed

Langkah 2. Buat materi iklan ({STORY_ID} dalam bentuk '{PAGE_ID}_{POST_ID}')

curl -X POST \ -F 'object_story_id="<PAGE_ID>_<POST_ID>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'object_story_id' : '<pageID>_<postID>', }; const adcreatives = (new AdAccount(id)).createAdCreative( fields, params ); logApiCallResult('adcreatives api call complete.', adcreatives);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdCreative; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'object_story_id' => '<pageID>_<postID>', ); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adcreative import AdCreative from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'object_story_id': '<pageID>_<postID>', } print AdAccount(id).create_ad_creative( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdCreative() .setObjectStoryId(\"<pageID>_<postID>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adcreatives = ad_account.adcreatives.create({ object_story_id: '<pageID>_<postID>', })

Langkah 3. Gunakan materi iklan dalam sebuah iklan

curl -X POST \ -F 'name="My AdGroup with Redownload"' \ -F 'adset_id="<AD_SET_ID>"' \ -F 'creative={ "creative_id": "<CREATIVE_ID>" }' \ -F 'redownload=1' \ -F 'status="PAUSED"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/ads
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const Ad = bizSdk.Ad; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My AdGroup with Redownload', 'adset_id' : '<adSetID>', 'creative' : {'creative_id':'<adCreativeID>'}, 'redownload' : '1', 'status' : 'PAUSED', }; const ads = (new AdAccount(id)).createAd( fields, params ); logApiCallResult('ads api call complete.', ads);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\Ad; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'My AdGroup with Redownload', 'adset_id' => '<adSetID>', 'creative' => array('creative_id' => '<adCreativeID>'), 'redownload' => '1', 'status' => 'PAUSED', ); echo json_encode((new AdAccount($id))->createAd( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.ad import Ad from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My AdGroup with Redownload', 'adset_id': '<adSetID>', 'creative': {'creative_id':'<adCreativeID>'}, 'redownload': '1', 'status': 'PAUSED', } print AdAccount(id).create_ad( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAd() .setName(\"My AdGroup with Redownload\") .setAdsetId(<adSetID>L) .setCreative( new AdCreative() .setFieldId(\"<adCreativeID>\") ) .setParam(\"redownload\", \"1\") .setStatus(Ad.EnumStatus.VALUE_PAUSED) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) ads = ad_account.ads.create({ name: 'My AdGroup with Redownload', adset_id: '<adSetID>', creative: {'creative_id':'<adCreativeID>'}, redownload: '1', status: 'PAUSED', })

Buat iklan gambar aplikasi seluler dengan tautan dalam, dioptimalkan untuk klik, membayar impresi

Langkah 1. Buat Postingan Halaman dengan gambar. Perhatikan bahwa Anda harus menggunakan PAGE_ACCESS_TOKEN dan sesi Pages API untuk membuat Postingan Halaman.

curl -X POST \ -F 'message="This is a test message"' \ -F 'call_to_action={ "type": "BUY_NOW", "value": { "link": "{app-store-url}", "app_link": "{deep-link}" } }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/{page-id}/feed
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const Page = bizSdk.Page; const PagePost = bizSdk.PagePost; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<PAGE_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'message' : 'This is a test message', 'call_to_action' : {'type':'BUY_NOW','value':{'link':'<appLink>','app_link':'<deepLinkURL>'}}, }; const feed = (new Page(id)).createFeed( fields, params ); logApiCallResult('feed api call complete.', feed);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\Page; use FacebookAds\Object\PagePost; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<PAGE_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'message' => 'This is a test message', 'call_to_action' => array('type' => 'BUY_NOW','value' => array('link' => '<appLink>','app_link' => '<deepLinkURL>')), ); echo json_encode((new Page($id))->createFeed( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.page import Page from facebook_business.adobjects.pagepost import PagePost from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PAGE_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'message': 'This is a test message', 'call_to_action': {'type':'BUY_NOW','value':{'link':'<appLink>','app_link':'<deepLinkURL>'}}, } print Page(id).create_feed( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<PAGE_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new Page(id, context).createFeed() .setMessage(\"This is a test message\") .setCallToAction(\"{\\"type\\":\\"BUY_NOW\\",\\"value\\":{\\"link\\":\\"<appLink>\\",\\"app_link\\":\\"<deepLinkURL>\\"}}\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<PAGE_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end page = FacebookAds::Page.get(id) feed = page.feed.create({ message: 'This is a test message', call_to_action: {'type':'BUY_NOW','value':{'link':'<appLink>','app_link':'<deepLinkURL>'}}, })

Langkah 2. Buat materi iklan

curl -X POST \ -F 'object_story_id="<PAGE_ID>_<POST_ID>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'object_story_id' : '<pageID>_<postID>', }; const adcreatives = (new AdAccount(id)).createAdCreative( fields, params ); logApiCallResult('adcreatives api call complete.', adcreatives);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdCreative; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'object_story_id' => '<pageID>_<postID>', ); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adcreative import AdCreative from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'object_story_id': '<pageID>_<postID>', } print AdAccount(id).create_ad_creative( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdCreative() .setObjectStoryId(\"<pageID>_<postID>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adcreatives = ad_account.adcreatives.create({ object_story_id: '<pageID>_<postID>', })

Langkah 3. Tetapkan tawaran di set iklan, dioptimalkan untuk klik, membayar impresi.

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
  AdSetFields::NAME => 'LifetimeBudgetSet',
  AdsetFields::LIFETIME_BUDGET => 100000,
  AdSetFields::BID_AMOUNT => 500,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::LINK_CLICKS,
  AdSetFields::PROMOTED_OBJECT => array(
      'application_id' => <APP_ID>,
      'object_store_url' => '<APP_STORE_URL>',
  ),
  AdSetFields::TARGETING => (new Targeting())->setData(array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array('US'),
    ),
    TargetingFields::USER_OS => array(
      'IOS',
    ),
    TargetingFields::PUBLISHER_PLATFORMS => array(
      'facebook',
      'audience_network',

    ),
    TargetingFields::FACEBOOK_POSITIONS => array('feed'),
  )),
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::END_TIME =>
    (new \DateTime("+1 week"))->format(\DateTime::ISO8601),
));

$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
import time
from facebookads.adobjects.adset import AdSet

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'LifetimeBudgetSet',
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.lifetime_budget: 10000,
    AdSet.Field.start_time: int(time.time()),
    AdSet.Field.end_time: int(time.time() + 100000),
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.link_clicks,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 500,
    AdSet.Field.promoted_object: {
        'application_id': <APP_ID>,
        'object_store_url': '<APP_STORE_URL>',
    },
    AdSet.Field.targeting: {
        'geo_locations': {
            'countries': ['US'],
        },
        'user_os': ['iOS'],
        Targeting.Field.publisher_platforms: ['facebook', 'audience_network'],
        Targeting.Field.facebook_positions: ['feed'],
    },
})

adset.remote_create(params={
    'status': AdSet.Status.paused,
})
curl \
  -F 'name=LifetimeBudgetSet' \
  -F 'lifetime_budget=100000' \
  -F 'bid_amount=500' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=LINK_CLICKS' \
  -F 'promoted_object={"application_id":"<APP_ID>","object_store_url":"<APP_STORE_URL>"}' \
  -F 'targeting={ 
    "facebook_positions": ["feed"], 
    "geo_locations": {"countries":["US"]}, 
    "publisher_platforms": ["facebook","audience_network"], 
    "user_os": ["IOS"] 
  }' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'end_time=2018-02-06T04:45:30+0000' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets

Langkah 4. Gunakan materi iklan dalam sebuah iklan

use FacebookAds\Object\Ad;
use FacebookAds\Object\Fields\AdFields;

$data = array(
  AdFields::NAME => 'My Ad',
  AdFields::ADSET_ID => <AD_SET_ID>,
  AdFields::CREATIVE => array(
    'creative_id' => <CREATIVE_ID>,
  ),
);

$ad = new Ad(null, 'act_<AD_ACCOUNT_ID>');
$ad->setData($data);
$ad->create(array(
  'redownload' => 1,
));
from facebookads.adobjects.ad import Ad

ad = Ad(parent_id='act_<AD_ACCOUNT_ID>')
ad[Ad.Field.name] = 'My Ad'
ad[Ad.Field.adset_id] = <AD_SET_ID>
ad[Ad.Field.creative] = {'creative_id': <CREATIVE_ID>}
ad[Ad.Field.redownload] = True
ad.remote_create(params={
    'status': Ad.Status.paused,
})
Ad ad = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAd()
  .setName("My Ad")
  .setAdsetId(<AD_SET_ID>)
  .setCreative(
    new AdCreative()
      .setFieldId(<CREATIVE_ID>)
  )
  .setRedownload(true)
  .execute();
String ad_id = ad.getId();
curl \
  -F 'name=My Ad' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"<CREATIVE_ID>"}' \
  -F 'redownload=1' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ads

Buat iklan gambar interaksi aplikasi seluler dengan tautan aplikasi, dioptimalkan untuk peristiwa aplikasi, membayar impresi

Langkah 1. Buat Postingan Halaman dengan gambar. Perhatikan bahwa Anda harus menggunakan PAGE_ACCESS_TOKEN dan sesi Pages API untuk membuat Postingan Halaman.

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$params = array(
  'message' => 'Check out this App today. Available on iTunes.',
  'published' => 1,
  'link' => '<APP_STORE_URL>',
  'picture' => '<IMAGE_URL>',
  'call_to_action' => array(
    'type' => 'LEARN_MORE',
    'value' => array(
      'link' => '<APP_STORE_URL>',
      'app_link' => '<APP_DEEP_LINK>',
    ),
  ),
);

$data = Api::instance()->call(
  '/'.<PAGE_ID>.'/feed',
  RequestInterface::METHOD_POST,
  $params)->getContent();
from facebookads import FacebookAdsApi

params = {
    'massage': 'Check out this App today. Available on iTunes.',
    'picture': '<IMAGE_URL>',
    'link': '<APP_STORE_URL>',
    'published': 1,
    'call_to_action': {
        'type': 'LEARN_MORE',
        'value': {
            'link': '<APP_STORE_URL>',
            'app_link': '<APP_DEEP_LINK>',
        },
    },
}

path = "/{}/feed".format(<PAGE_ID>)
data = FacebookAdsApi.get_default_api().call('POST', (path,), params=params)
curl \
  -F 'message=Check out this App today. Available on iTunes.' \
  -F 'published=1' \
  -F 'link=<APP_STORE_URL>' \
  -F 'picture=<IMAGE_URL>' \
  -F 'call_to_action={ 
    "type": "LEARN_MORE", 
    "value": {"link":"<APP_STORE_URL>","app_link":"<APP_DEEP_LINK>"} 
  }' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PAGE_ID>/feed

Langkah 2. Buat materi iklan

curl -X POST \ -F 'object_story_id="<PAGE_ID>_<POST_ID>"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdCreative = bizSdk.AdCreative; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'object_story_id' : '<pageID>_<postID>', }; const adcreatives = (new AdAccount(id)).createAdCreative( fields, params ); logApiCallResult('adcreatives api call complete.', adcreatives);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdCreative; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'object_story_id' => '<pageID>_<postID>', ); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adcreative import AdCreative from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'object_story_id': '<pageID>_<postID>', } print AdAccount(id).create_ad_creative( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdCreative() .setObjectStoryId(\"<pageID>_<postID>\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adcreatives = ad_account.adcreatives.create({ object_story_id: '<pageID>_<postID>', })

Langkah 3. Atur tawaran pada set iklan, dioptimalkan untuk peristiwa aplikasi, membayar impresi.

Perhatikan bahwa Anda juga harus mengatur promoted_object set iklan untuk menyertakan custom_event_type set iklan yang akan dioptimalkan, baca dokumen set iklan untuk detail selengkapnya.

curl -X POST \ -F 'name="A CPA Ad Set optimized for App Events"' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'daily_budget=300' \ -F 'start_time="2024-05-12T09:25:23-0700"' \ -F 'end_time="2024-05-19T09:25:23-0700"' \ -F 'billing_event="IMPRESSIONS"' \ -F 'optimization_goal="OFFSITE_CONVERSIONS"' \ -F 'bid_amount=100' \ -F 'status="PAUSED"' \ -F 'promoted_object={ "application_id": "<APP_ID>", "object_store_url": "<APP_STORE_URL>", "custom_event_type": "PURCHASE" }' \ -F 'targeting={ "facebook_positions": [ "feed" ], "geo_locations": { "countries": [ "US" ] }, "user_os": [ "iOS" ] }' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'A CPA Ad Set optimized for App Events', 'campaign_id' : '<adCampaignAppInstallsID>', 'daily_budget' : '300', 'start_time' : '2024-04-08T11:26:49-0700', 'end_time' : '2024-04-15T11:26:49-0700', 'billing_event' : 'IMPRESSIONS', 'optimization_goal' : 'OFFSITE_CONVERSIONS', 'bid_amount' : '100', 'status' : 'PAUSED', 'promoted_object' : {'application_id':'<appID>','object_store_url':'<appLink>','custom_event_type':'PURCHASE'}, 'targeting' : {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'user_os':['iOS']}, }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdSet; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'A CPA Ad Set optimized for App Events', 'campaign_id' => '<adCampaignAppInstallsID>', 'daily_budget' => '300', 'start_time' => '2024-04-08T11:26:49-0700', 'end_time' => '2024-04-15T11:26:49-0700', 'billing_event' => 'IMPRESSIONS', 'optimization_goal' => 'OFFSITE_CONVERSIONS', 'bid_amount' => '100', 'status' => 'PAUSED', 'promoted_object' => array('application_id' => '<appID>','object_store_url' => '<appLink>','custom_event_type' => 'PURCHASE'), 'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US')),'user_os' => array('iOS')), ); echo json_encode((new AdAccount($id))->createAdSet( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'A CPA Ad Set optimized for App Events', 'campaign_id': '<adCampaignAppInstallsID>', 'daily_budget': '300', 'start_time': '2024-04-08T11:26:49-0700', 'end_time': '2024-04-15T11:26:49-0700', 'billing_event': 'IMPRESSIONS', 'optimization_goal': 'OFFSITE_CONVERSIONS', 'bid_amount': '100', 'status': 'PAUSED', 'promoted_object': {'application_id':'<appID>','object_store_url':'<appLink>','custom_event_type':'PURCHASE'}, 'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'user_os':['iOS']}, } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"A CPA Ad Set optimized for App Events\") .setCampaignId(\"<adCampaignAppInstallsID>\") .setDailyBudget(300L) .setStartTime(\"2024-04-08T11:26:49-0700\") .setEndTime(\"2024-04-15T11:26:49-0700\") .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_OFFSITE_CONVERSIONS) .setBidAmount(100L) .setStatus(AdSet.EnumStatus.VALUE_PAUSED) .setPromotedObject(\"{\\"application_id\\":\\"<appID>\\",\\"object_store_url\\":\\"<appLink>\\",\\"custom_event_type\\":\\"PURCHASE\\"}\") .setTargeting( new Targeting() .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCountries(Arrays.asList(\"US\")) ) .setFieldUserOs(Arrays.asList(\"iOS\")) ) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'A CPA Ad Set optimized for App Events', campaign_id: '<adCampaignAppInstallsID>', daily_budget: '300', start_time: '2024-04-08T11:26:49-0700', end_time: '2024-04-15T11:26:49-0700', billing_event: 'IMPRESSIONS', optimization_goal: 'OFFSITE_CONVERSIONS', bid_amount: '100', status: 'PAUSED', promoted_object: {'application_id':'<appID>','object_store_url':'<appLink>','custom_event_type':'PURCHASE'}, targeting: {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'user_os':['iOS']}, })

Langkah 4. Gunakan materi iklan dalam sebuah iklan

use FacebookAds\Object\Ad;
use FacebookAds\Object\Fields\AdFields;

$data = array(
  AdFields::NAME => 'My Ad',
  AdFields::ADSET_ID => <AD_SET_ID>,
  AdFields::CREATIVE => array(
    'creative_id' => <CREATIVE_ID>,
  ),
);

$ad = new Ad(null, 'act_<AD_ACCOUNT_ID>');
$ad->setData($data);
$ad->create(array(
  'redownload' => 1,
));
from facebookads.adobjects.ad import Ad

ad = Ad(parent_id='act_<AD_ACCOUNT_ID>')
ad[Ad.Field.name] = 'My Ad'
ad[Ad.Field.adset_id] = <AD_SET_ID>
ad[Ad.Field.creative] = {'creative_id': <CREATIVE_ID>}
ad[Ad.Field.redownload] = True
ad.remote_create(params={
    'status': Ad.Status.paused,
})
Ad ad = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAd()
  .setName("My Ad")
  .setAdsetId(<AD_SET_ID>)
  .setCreative(
    new AdCreative()
      .setFieldId(<CREATIVE_ID>)
  )
  .setRedownload(true)
  .execute();
String ad_id = ad.getId();
curl \
  -F 'name=My Ad' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"<CREATIVE_ID>"}' \
  -F 'redownload=1' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ads

Contoh untuk iklan Postingan Halaman

Perhatikan bahwa Anda harus menggunakan PAGE_ACCESS_TOKEN dan sesi Pages API untuk membuat Postingan Halaman. Untuk postingan video, domainnya "video-graph.facebook.com" dan bukan "graph.facebook.com".

Membuat iklan video instalasi aplikasi seluler

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$params = array(
  'name' => 'My Video',
  'message' => 'Check out this app!',
  'thumbnail' => '<THUMBNAIL_PATH>',
  'published' => 0,
  'call_to_action' => array(
    'type' => AdCreativeCallToActionTypeValues::INSTALL_MOBILE_APP,
    'value' => array(
      'link' => '<APP_STORE_URL>',
    ),
  ),
);

$request = Api::instance()->prepareRequest(
  '/'.<PAGE_ID>.'/videos',
  RequestInterface::METHOD_POST,
  $params);

$request->setLastLevelDomain('graph-video');
$request->getFileParams()->offsetSet('source', '<VIDEO_PATH>');
$response = Api::instance()->executeRequest($request);

$data = $response->getContent();
from facebookads import FacebookAdsApi

params = {
    'name': 'My Video',
    'massage': 'Check out this app!',
    'thumbnail': '<THUMBNAIL_URL>',
    'published': 0,
    'call_to_action': {
        'type': 'INSTALL_MOBILE_APP',
        'value': {
            'link': '<APP_STORE_URL>',
        },
    },
}

url = 'https://graph-video.facebook.com/' + FacebookAdsApi.API_VERSION
path = "/{}/videos".format(<PAGE_ID>)
files = {'source': open('<VIDEO_PATH>', 'rb')}

data = FacebookAdsApi.get_default_api().call(
    'POST',
    url + path,
    params=params,
    files=files
)
curl \
  -F 'name=My Video' \
  -F 'message=Check out this app!' \
  -F 'thumbnail=<APP_STORE_URL>' \
  -F 'published=0' \
  -F 'call_to_action={"type":"INSTALL_MOBILE_APP","value":{"link":"<APP_STORE_URL>"}}' \
  -F 'source=@<VIDEO_PATH>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph-video.facebook.com/v2.11/<PAGE_ID>/videos

Membuat iklan video aplikasi seluler dengan tautan dalam

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$params = array(
  'name' => 'My Video',
  'message' => 'Check out this app!',
  'thumbnail' => '<THUMBNAIL_PATH>',
  'published' => 0,
  'call_to_action' => array(
    'type' => AdCreativeCallToActionTypeValues::LEARN_MORE,
    'value' => array(
      'link' => '<APP_STORE_URL>',
      'app_link' => '<APP_DEEP_LINK>',
    ),
  ),
);
$request = Api::instance()->prepareRequest(
  '/'.<PAGE_ID>.'/videos',
  RequestInterface::METHOD_POST,
  $params);

$request->setLastLevelDomain('graph-video');
$request->getFileParams()->offsetSet('source', '<VIDEO_PATH>');
$response = Api::instance()->executeRequest($request);

$data = $response->getContent();
from facebookads import FacebookAdsApi

params = {
    'name': 'My Video',
    'massage': 'Check out this app!',
    'thumbnail': '<THUMBNAIL_URL>',
    'published': 0,
    'call_to_action': {
        'type': 'LEARN_MORE',
        'value': {
            'link': '<APP_STORE_URL>',
            'app_link': '<APP_DEEP_LINK>',
        },
    },
}

url = 'https://graph-video.facebook.com/' + FacebookAdsApi.API_VERSION
path = "/{}/videos".format(<PAGE_ID>)
files = {'source': open('<VIDEO_PATH>', 'rb')}

data = FacebookAdsApi.get_default_api().call(
    'POST',
    url + path,
    params=params,
    files=files
)
curl \
  -F 'name=My Video' \
  -F 'message=Check out this app!' \
  -F 'thumbnail=<APP_STORE_URL>' \
  -F 'published=0' \
  -F 'call_to_action={ 
    "type": "LEARN_MORE", 
    "value": {"link":"<APP_STORE_URL>","app_link":"<APP_DEEP_LINK>"} 
  }' \
  -F 'source=@<VIDEO_PATH>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph-video.facebook.com/v2.11/<PAGE_ID>/videos

Membuat iklan video instalasi aplikasi desktop

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$params = array(
  'name' => 'My Video',
  'message' => 'Check out this app!',
  'thumbnail' => '<THUMBNAIL_PATH>',
  'published' => 0,
  'call_to_action' => array(
    'type' => AdCreativeCallToActionTypeValues::PLAY_GAME,
    'value' => array(
      'link' => '<URL>',
    ),
  ),
);
$request = Api::instance()->prepareRequest(
  '/'.<PAGE_ID>.'/videos',
  RequestInterface::METHOD_POST,
  $params);

$request->setLastLevelDomain('graph-video');
$request->getFileParams()->offsetSet('source', '<VIDEO_PATH>');
$response = Api::instance()->executeRequest($request);

$data = $response->getContent();
from facebookads import FacebookAdsApi

params = {
    'name': 'My Video',
    'massage': 'Check out this app!',
    'thumbnail': '<THUMBNAIL_URL>',
    'published': 0,
    'call_to_action': {
        'type': 'PLAY_GAME',
        'value': {
            'link': '<URL>',
        },
    },
}

url = 'https://graph-video.facebook.com/' + FacebookAdsApi.API_VERSION
path = "/{}/videos".format(<PAGE_ID>)
files = {'source': open('<VIDEO_PATH>', 'rb')}

data = FacebookAdsApi.get_default_api().call(
    'POST',
    '<URL>' + path,
    params=params,
    files=files
)
curl \
  -F 'name=My Video' \
  -F 'message=Check out this app!' \
  -F 'thumbnail=<THUMBNAIL_PATH>' \
  -F 'published=0' \
  -F 'call_to_action={"type":"PLAY_GAME","value":{"link":"<THUMBNAIL_PATH>"}}' \
  -F 'source=@<VIDEO_PATH>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph-video.facebook.com/v2.11/<PAGE_ID>/videos

Membuat iklan aplikasi desktop untuk iklan gambar barang virtual

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$params = array(
  'message' => 'Buy coins now!',
  'picture' => '<IMAGE_URL>',
  'link' => '<LINK>',
  'published' => 1,
  'call_to_action' => array(
    'type' => AdCreativeCallToActionTypeValues::BUY_NOW,
    'value' => array(
      'link' => '<LINK>',
      'product_link' => '<PRODUCT_LINK>',
    ),
  ),
);

$data = Api::instance()->call(
  '/'.<PAGE_ID>.'/feed',
  RequestInterface::METHOD_POST,
  $params)->getContent();
from facebookads import FacebookAdsApi

params = {
    'massage': 'Buy coins now!',
    'picture': '<IMAGE_URL>',
    'link': '<LINK>',
    'published': 1,
    'call_to_action': {
        'type': 'BUY_NOW',
        'value': {
            'link': '<LINK>',
            'product_link': '<PRODUCT_LINK>',
        },
    },
}

data = FacebookAdsApi.get_default_api().\
    call('POST', (<PAGE_ID>, 'feed'), params=params)
curl \
  -F 'message=Buy coins now!' \
  -F 'picture=<IMAGE_URL>' \
  -F 'link=<LINK>' \
  -F 'published=1' \
  -F 'call_to_action={"type":"BUY_NOW","value":{"link":"<LINK>","product_link":"<PRODUCT_LINK>"}}' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PAGE_ID>/feed

Membuat iklan aplikasi desktop untuk iklan video barang virtual

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;
use FacebookAds\Object\Values\AdCreativeCallToActionTypeValues;

$params = array(
  'name' => 'My Video',
  'message' => 'Buy coins now!',
  'thumbnail' => '<THUMBNAIL_PATH>',
  'published' => 0,
  'call_to_action' => array(
    'type' => AdCreativeCallToActionTypeValues::BUY_NOW,
    'value' => array(
      'link' => '<APP_URL>',
      'product_link' => '<PRODUCT_LINK>',
    ),
  ),
);

$request = Api::instance()->prepareRequest(
  '/'.<PAGE_ID>.'/videos',
  RequestInterface::METHOD_POST,
  $params);

$request->setLastLevelDomain('graph-video');
$request->getFileParams()->offsetSet('source', '<VIDEO_PATH>');
$response = Api::instance()->executeRequest($request);

$data = $response->getContent();
from facebookads import FacebookAdsApi

params = {
    'name': 'My Video',
    'massage': 'Buy coins now!',
    'thumbnail': '<THUMBNAIL_URL>',
    'published': 0,
    'call_to_action': {
        'type': 'BUY_NOW',
        'value': {
            'link': '<APP_STORE_URL>',
            'product_link': '<PRODUCT_LINK>',
        },
    },
}

files = {'source': open('<VIDEO_PATH>', 'rb')}

data = FacebookAdsApi.get_default_api().call(
    'POST', (<PAGE_ID>, 'videos'),
    params=params,
    files=files
)
curl \
  -F 'name=My Video' \
  -F 'message=Buy coins now!' \
  -F 'thumbnail=<THUMBNAIL_PATH>' \
  -F 'published=0' \
  -F 'call_to_action={ 
    "type": "BUY_NOW", 
    "value": {"link":"<THUMBNAIL_PATH>","product_link":"<THUMBNAIL_PATH>"} 
  }' \
  -F 'source=@<VIDEO_PATH>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph-video.facebook.com/v2.11/<PAGE_ID>/videos

Iklan Katalog Advantage+ untuk Penginstalan Aplikasi Seluler

Iklan katalog Advantage+ dapat mendorong orang untuk menginstal aplikasi seluler Anda. Ini memungkinkan Anda untuk menargetkan ulang orang-orang dengan iklan instalasi seluler, berdasarkan perilaku pengguna.

Langkah 1. Buat kampanye untuk katalog produk Anda

curl -X POST \ -F 'name="App Installs Campaign with Dynamic Product Ads"' \ -F 'objective="OUTCOME_APP_PROMOTION"' \ -F 'status="PAUSED"' \ -F 'special_ad_categories=[]' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/campaigns
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const Campaign = bizSdk.Campaign; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'App Installs Campaign with Dynamic Product Ads', 'objective' : 'OUTCOME_APP_PROMOTION', 'status' : 'PAUSED', 'special_ad_categories' : [], }; const campaigns = (new AdAccount(id)).createCampaign( fields, params ); logApiCallResult('campaigns api call complete.', campaigns);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\Campaign; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'App Installs Campaign with Dynamic Product Ads', 'objective' => 'OUTCOME_APP_PROMOTION', 'status' => 'PAUSED', 'special_ad_categories' => array(), ); echo json_encode((new AdAccount($id))->createCampaign( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.campaign import Campaign from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'App Installs Campaign with Dynamic Product Ads', 'objective': 'OUTCOME_APP_PROMOTION', 'status': 'PAUSED', 'special_ad_categories': [], } print AdAccount(id).create_campaign( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createCampaign() .setName(\"App Installs Campaign with Dynamic Product Ads\") .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_APP_PROMOTION) .setStatus(Campaign.EnumStatus.VALUE_PAUSED) .setParam(\"special_ad_categories\", \"[]\") .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) campaigns = ad_account.campaigns.create({ name: 'App Installs Campaign with Dynamic Product Ads', objective: 'OUTCOME_APP_PROMOTION', status: 'PAUSED', special_ad_categories: [], })

Langkah 2. Buat set iklan untuk produk tertentu yang ditetapkan di bawah katalog produk di atas

use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;

$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');

$adset->setData(array(
  AdSetFields::NAME => 'Mobile App Installs Ad Set with Dynamic Product Ads',
  AdSetFields::BID_AMOUNT => 3000,
  AdSetFields::BILLING_EVENT => AdSetBillingEventValues::IMPRESSIONS,
  AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::APP_INSTALLS,
  AdSetFields::DAILY_BUDGET => 15000,
  AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
  AdSetFields::TARGETING => array(
    TargetingFields::GEO_LOCATIONS => array(
      'countries' => array('US'),
    ),
    TargetingFields::PUBLISHER_PLATFORMS => array(
      'facebook',
      'audience_network',
    ),
    TargetingFields::DEVICE_PLATFORMS => array('mobile'),
    TargetingFields::USER_OS => array(
      'IOS',
    ),
    TargetingFields::DYNAMIC_AUDIENCE_IDS => array(<PRODUCT_AUDIENCE_ID>),
  ),
  AdSetFields::PROMOTED_OBJECT => array(
    'product_set_id' => <PRODUCT_SET_ID>,
    'application_id' => <APP_ID>,
    'object_store_url' => '<APP_STORE_URL>',
  ),
));

$adset->create(array(
  AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
from facebookads.adobjects.adset import AdSet
from facebookads.adobjects.targeting import Targeting

adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
    AdSet.Field.name: 'Mobile App Installs Ad Set with Dynamic Product Ads',
    AdSet.Field.promoted_object: {
        'product_set_id': product_set_id,
        'application_id': <APP_ID>,
        'object_store_url': '<APP_STORE_URL>',
    },
    AdSet.Field.campaign_id: <CAMPAIGN_ID>,
    AdSet.Field.daily_budget: 15000,
    AdSet.Field.optimization_goal: AdSet.OptimizationGoal.app_installs,
    AdSet.Field.billing_event: AdSet.BillingEvent.impressions,
    AdSet.Field.bid_amount: 3000,
    AdSet.Field.targeting: {
        Targeting.Field.geo_locations: {
            'countries': ['US'],
        },
        Targeting.Field.publisher_platforms: ['facebook', 'audience_network'],
        Targeting.Field.device_platforms: ['mobile'],
        Targeting.Field.user_os: [
            'IOS',
        ],
        Targeting.Field.dynamic_audience_ids: [
            <PRODUCT_AUDIENCE_ID>,
        ],
    },
})

adset.remote_create(params={
    'status': AdSet.Status.paused,
})
curl \
  -F 'name=Mobile App Installs Ad Set with Dynamic Product Ads' \
  -F 'bid_amount=3000' \
  -F 'billing_event=IMPRESSIONS' \
  -F 'optimization_goal=APP_INSTALLS' \
  -F 'daily_budget=15000' \
  -F 'campaign_id=<CAMPAIGN_ID>' \
  -F 'targeting={ 
    "geo_locations": {"countries":["US"]}, 
    "publisher_platforms": ["facebook","audience_network"], 
    "device_platforms": ["mobile"], 
    "user_os": ["IOS"], 
    "dynamic_audience_ids": ["<PRODUCT_AUDIENCE_ID>"] 
  }' \
  -F 'promoted_object={ 
    "product_set_id": "<PRODUCT_SET_ID>", 
    "application_id": "<APP_ID>", 
    "object_store_url": "<APP_STORE_URL>" 
  }' \
  -F 'status=PAUSED' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/adsets

Langkah 3. Buat materi iklan katalog Advantage+ menggunakan template

curl -X POST \
  -F 'name="Advantage+ catalog ads template creative sample"' \
  -F 'object_story_spec={
       "page_id": "<PAGE_ID>",
       "template_data": {
         "call_to_action": {
           "type": "INSTALL_MOBILE_APP",
           "value": {
             "link": "http://www.example.com/appstoreurl"
           }
         },
         "message": "Test {{product.name | titleize}}",
         "link": "http://www.example.com/appstoreurl",
         "name": "Headline {{product.price}}",
         "description": "Description {{product.description}}"
       }
     }' \
  -F 'product_set_id="<PRODUCT_SET_ID>"' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adcreatives

Langkah 4. Gunakan materi Iklan di atas dalam sebuah Iklan

use FacebookAds\Object\Ad;
use FacebookAds\Object\Fields\AdFields;

$data = array(
  AdFields::NAME => 'My Ad',
  AdFields::ADSET_ID => <AD_SET_ID>,
  AdFields::CREATIVE => array(
    'creative_id' => <CREATIVE_ID>,
  ),
);

$ad = new Ad(null, 'act_<AD_ACCOUNT_ID>');
$ad->setData($data);
$ad->create(array(
  'redownload' => 1,
));
from facebookads.adobjects.ad import Ad

ad = Ad(parent_id='act_<AD_ACCOUNT_ID>')
ad[Ad.Field.name] = 'My Ad'
ad[Ad.Field.adset_id] = <AD_SET_ID>
ad[Ad.Field.creative] = {'creative_id': <CREATIVE_ID>}
ad[Ad.Field.redownload] = True
ad.remote_create(params={
    'status': Ad.Status.paused,
})
Ad ad = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAd()
  .setName("My Ad")
  .setAdsetId(<AD_SET_ID>)
  .setCreative(
    new AdCreative()
      .setFieldId(<CREATIVE_ID>)
  )
  .setRedownload(true)
  .execute();
String ad_id = ad.getId();
curl \
  -F 'name=My Ad' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"<CREATIVE_ID>"}' \
  -F 'redownload=1' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ads

Mengunggah File HTML yang Bisa Diputar ke Akun Iklan

curl \
 -X POST \
 -F "name=<name>" \
 -F "source=<>" \
 -F "access_token=<access_token>" \
 "https://graph.facebook.com/<API_VERSION>/act_<account_id>/adplayables"
  • name: Nama yang membedakan aset iklan dari iklan yang bisa dimainkan lainnya di akun iklan; contoh: {ad_name} -> {playable_asset_name}
  • source: Jalur absolut file di komputer lokal Anda
  • access_token: Dapat dibuat dari Graph API Explorer
  • Anda juga dapat menggunakan ID aset yang bisa diputar yang ada di dalam akun iklan

Tanda Meta di File HTML yang Bisa Diputar

Anda dapat menambahkan dua tanda metadata ke file HTML 5 Anda yang bisa diputar. Ini memungkinkan Meta untuk mengatribusikan yang bisa diputar dalam iklan ke aplikasi Anda.

...
<head>
  ...
  <meta name="ref-application-id" content="<YOUR_APP_ID>">
  <meta name="ref-asset-id" content="<YOUR_ASSET_ID>">
  ...
</head>
...
  • Berikan ID aplikasi Meta dan tanda meta ID aset Anda di file HTML yang bisa diputar. Ini membantu Meta memberikan insight yang akurat tentang aset saat muncul di iklan Anda.
  • ID aset secara unik mengidentifikasi elemen yang bisa diputar ini di sistem Anda.

Membuat Iklan di Akun Iklan

  • Menetapkan penempatan ke Kabar Facebook. Hanya Video Berhadiah dan Interstisial Audience Network. Hubungi partner Meta Anda untuk detail selengkapnya.
  • Materi iklan hanya bisa berupa video dengan rasio aspek >=1
  • Siapkan anggaran dan jadwal
  • Buat materi iklan yang bisa diputar di API:
curl \
  -F 'name=Sample Creative' \
  -F 'object_story_spec={ 
    "page_id": "<PAGE_ID>", 
    "video_data": { 
      "call_to_action": {"type":"INSTALL_MOBILE_APP","value":{"application":<APP_ID>,"link":"<APP_STORE_URL>"}}, 
      "image_url": "<THUMBNAIL_URL>", 
      "link_description": "try it out", 
      "video_id": "<VIDEO_ID>" 
    } 
  }' \
  -F 'playable_asset_id=<PLAYABLE_ASSET_ID>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/adcreatives
  • Membuat iklan di API:
curl \
  -F 'name=My Ad' \
  -F 'status=ACTIVE' \
  -F 'adset_id=<AD_SET_ID>' \
  -F 'creative={"creative_id":"<CREATIVE_ID>"}' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/ads