Class: FacebookAds::AdCreative
- Defined in:
- lib/facebook_ads/ad_creative.rb
Overview
Ad ad creative has many ad images and belongs to an ad account. developers.facebook.com/docs/marketing-api/reference/ad-creative
Constant Summary collapse
- FIELDS =
%w[id name object_story_id object_story_spec object_type thumbnail_url product_set_id url_tags status].freeze
- CALL_TO_ACTION_TYPES =
%w[SHOP_NOW INSTALL_MOBILE_APP USE_MOBILE_APP SIGN_UP DOWNLOAD BUY_NOW NO_BUTTON].freeze
Class Method Summary collapse
- .carousel(name:, page_id:, link:, message:, assets:, call_to_action_type:, multi_share_optimized:, multi_share_end_card:, instagram_actor_id: nil, app_link: nil) ⇒ Object
- .link(name:, title:, body:, link_url:, image_hash:, page_id:) ⇒ Object
- .photo(name:, page_id:, message:, link:, link_title:, image_hash:, call_to_action_type:, instagram_actor_id: nil, app_link: nil, link_description: nil) ⇒ Object
- .product_set(name:, page_id:, link:, message:, headline:, description:, product_set_id:) ⇒ Object
Methods inherited from Base
all, delete, #destroy, find, find_by, get, paginate, post, #save, #update
Class Method Details
.carousel(name:, page_id:, link:, message:, assets:, call_to_action_type:, multi_share_optimized:, multi_share_end_card:, instagram_actor_id: nil, app_link: nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/facebook_ads/ad_creative.rb', line 39 def carousel(name:, page_id:, link:, message:, assets:, call_to_action_type:, multi_share_optimized:, multi_share_end_card:, instagram_actor_id: nil, app_link: nil) object_story_spec = { 'page_id' => page_id, # 300664329976860 'instagram_actor_id' => instagram_actor_id, # 503391023081924 'link_data' => { 'link' => link, # https://tophatter.com/, https://itunes.apple.com/app/id619460348, http://play.google.com/store/apps/details?id=com.tophatter 'message' => , 'call_to_action' => { 'type' => call_to_action_type, 'value' => { 'link' => link, 'app_link' => app_link } }, 'child_attachments' => assets.collect do |asset| { 'link' => asset[:link] || link, 'image_hash' => asset[:hash], 'name' => asset[:title], # 'description' => asset[:title], 'call_to_action' => { # Redundant? 'type' => call_to_action_type, 'value' => { 'link' => asset[:link] || link, 'app_link' => asset[:app_link] || app_link } } } end, 'multi_share_optimized' => multi_share_optimized, 'multi_share_end_card' => multi_share_end_card } } { name: name, object_story_spec: object_story_spec.to_json } end |
.link(name:, title:, body:, link_url:, image_hash:, page_id:) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/facebook_ads/ad_creative.rb', line 96 def link(name:, title:, body:, link_url:, image_hash:, page_id:) object_story_spec = { 'page_id' => page_id, 'link_data' => { 'name' => title, 'message' => body, 'link' => link_url, 'image_hash' => image_hash } } { name: name, object_story_spec: object_story_spec.to_json } end |
.photo(name:, page_id:, message:, link:, link_title:, image_hash:, call_to_action_type:, instagram_actor_id: nil, app_link: nil, link_description: nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/facebook_ads/ad_creative.rb', line 11 def photo(name:, page_id:, message:, link:, link_title:, image_hash:, call_to_action_type:, instagram_actor_id: nil, app_link: nil, link_description: nil) object_story_spec = { 'page_id' => page_id, # 300664329976860 'instagram_actor_id' => instagram_actor_id, # 503391023081924 'link_data' => { 'name' => link_title, 'description' => link_description, 'link' => link, # https://tophatter.com/, https://itunes.apple.com/app/id619460348, http://play.google.com/store/apps/details?id=com.tophatter 'message' => , 'image_hash' => image_hash, 'call_to_action' => { 'type' => call_to_action_type, 'value' => { # 'application' =>, 'link' => link, 'app_link' => app_link } } } } { name: name, object_story_spec: object_story_spec.to_json } end |
.product_set(name:, page_id:, link:, message:, headline:, description:, product_set_id:) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/facebook_ads/ad_creative.rb', line 79 def product_set(name:, page_id:, link:, message:, headline:, description:, product_set_id:) { name: name, object_story_spec: { page_id: page_id, template_data: { description: description, link: link, message: , name: headline } }, template_url: link, product_set_id: product_set_id } end |