實戰facebook marketing api

38
Yu LI Solutions Engineer APAC VFacebook Marketing API

Upload: yu-li

Post on 08-Feb-2017

558 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: 實戰Facebook Marketing API

Yu LI

Solutions Engineer

APAC

Facebook Marketing API

Page 3: 實戰Facebook Marketing API

Marketing API

Page 4: 實戰Facebook Marketing API

的 API會

5https://developers.facebook.com/tools/explorer/

Page 5: 實戰Facebook Marketing API

metadata=1

6

Page 6: 實戰Facebook Marketing API

Build things ... to work less

change your life world

Page 7: 實戰Facebook Marketing API

Case 1

Page 8: 實戰Facebook Marketing API

9

Page 9: 實戰Facebook Marketing API

會1. Feed在2. Facebook Business Manager

3. Feed在4. Facebook 在5.

6. 1

10

Page 10: 實戰Facebook Marketing API

Facebook UI

11

• 24

• <24

Page 11: 實戰Facebook Marketing API

12https://developers.facebook.com/docs/marketing-api/dynamic-product-ads/product-catalog

Facebook

API

Page 12: 實戰Facebook Marketing API

feed_id = '<your product feed id>'

feed_upload = ProductFeedUpload(feed_id)

feed_upload.url = 'https;//www.apple2.com/myproducts.xml'

r = feed_upload.remote_create()

print('Upload started with id={}'.format(r.id))

Python sample code to upload feed

Page 13: 實戰Facebook Marketing API

catalog_id = '<INSERT_YOUR_CATALOG_ID_HERE>'

catalog = ProductCatalog(catalog_id)

for item in items:

product_id, new_price = item

if new_price == '-':

response = catalog.update_product(

product_id,

availability=Product.Availability.out_of_stock

)

print('Product {} is now out of stock'.format(product_id))

else:

# prices should be in cents and be an integer

new_price_in_cents = int(float(new_price) * 100)

response = catalog.update_product(

product_id,

price=new_price_in_cents,

availability=Product.Availability.in_stock,

)

print('Product {} is now costs R$ {}'.format(product_id, new_price))

Python sample code to update product

Page 14: 實戰Facebook Marketing API

15

Mock UI

Page 15: 實戰Facebook Marketing API

人會

16

Scan

Feed XML

Notification

Page 16: 實戰Facebook Marketing API

Case 2

Page 17: 實戰Facebook Marketing API

18

Yu's Personal Report

Page 18: 實戰Facebook Marketing API

19

Yu's Ads Manager

Page 19: 實戰Facebook Marketing API

1. Facebook Ads Manager

2.要3. Excel在4. Excel在 到copy

5. Excel在6.

7.

8.

20

Page 20: 實戰Facebook Marketing API

1. Facebook Ads Manager 1-click 个2.

3. Excel在4. Excel在 到copy

5. Excel在 1-click 个 Excel

6.

7.

8. Robot

21

Page 21: 實戰Facebook Marketing API

for my_ad_account_id in my_ad_account_ids:

ad_account = AdAccount(my_ad_account_id)

fields = [

'campaign_group_name', 'campaign_name',

'campaign_id', 'impressions', 'clicks',

'spend', 'reach', 'actions', 'action_values'

]

params = {

'time_range': {

'since': report_date,

'until': report_date

},

'action_attribution_windows': ['28d_click'],

'breakdowns': ['impression_device', 'placement'],

'level': 'campaign',

'limit': max_records

}

ad_insights = ad_account.get_insights(fields, params)

count = 0

for idx in range(0,min(max_records,len(ad_insights))):

ad_insight = ad_insights[idx]

writeAdInsight(ad_insight, con, report_date)

22

Ad Insights

Page 22: 實戰Facebook Marketing API

def writeAdInsight(ad_insight, con, report_date):

key_str = ""

value_str = ""

count = 0

for (key, value) in key_value.items():

if count > 0:

key_str += ", "

value_str += ", "

key_str += key

value_str += "\"" + unicode(value) + "\""

count += 1

stat = "INSERT INTO ad_set_insight (" + key_str + \

") VALUES (" + value_str + ")";

print stat

cur = con.cursor()

cur.execute(stat)

Page 23: 實戰Facebook Marketing API

DEMO

24

Page 24: 實戰Facebook Marketing API

25

1. Facebook

2.

3. Excel

4.

5. Excel

6. Email

Page 25: 實戰Facebook Marketing API

Case 3

是 會

Page 26: 實戰Facebook Marketing API

27

Page 27: 實戰Facebook Marketing API

28

一 會

Page 28: 實戰Facebook Marketing API

29

到 一會

Page 29: 實戰Facebook Marketing API

30

1-click 我

Data Mining

Page 30: 實戰Facebook Marketing API

1-click

31

上 Marketing API

Page 31: 實戰Facebook Marketing API

會 “ ROI < 3到 ”

“ CTR > 3%到 CPC < 1.5USD到 1000USD”

“ CTR < 2%到 CPC > 1 USD, ”

32

Page 32: 實戰Facebook Marketing API

33

“ ROI < 3到...”“ ROI < 3到...”

“ ROI < 3到...”

Page 33: 實戰Facebook Marketing API

Data Mining

34

人“ 有 到 到 會”

“ 會”

“ 到 個 會”

Data Mining 個

Page 34: 實戰Facebook Marketing API

35

1-click 我

Data

Mining

Page 35: 實戰Facebook Marketing API

36

IT

Page 36: 實戰Facebook Marketing API

Resources

37

Page 37: 實戰Facebook Marketing API

▪ Official Developer Site▪ https://developers.facebook.com/docs/marketing-api

▪ Official Facebook Group▪ https://www.facebook.com/marketingdevelopers

▪ Samples, Play and Discover▪ https://www.facebookmarketingdevelopers.com

38

Page 38: 實戰Facebook Marketing API

https://developers.facebook.com/docs/marketing-api