Giter Site home page Giter Site logo

django-facebook-ads-targetings's Introduction

why

facebook ads targeting 的結構還頗複雜.. 我們又需要把targeting 的選項拿出來, 所以特別做這包

install

git clone [email protected]:georgefs/django-facebook-ads-targetings.git
cd django-facebook-ads-targetings
python setup.py install

add to settings.py:

INSTALLED_APPS = (
    ...
    'facebook_ads_targetings'
)

usage

https://developers.facebook.com/docs/marketing-api/targeting-specs/v2.2#interests

拿interests 的targeting 來做範例

In [1]: from facebook_ads_targetings import *

In [2]: interests_targeting = get_targeting('interests')

In [3]: print interests_targeting
<FacebookTargeting:interests>

In [4]: print interests_targeting.search()  ## 用 v2.2/search api query facebook 的結果
{u'data': [{u'path': [u'Shopping and fashion', u'Beauty', u'Cosmetics'], u'audience_size': 336332120, u'type': u'interests', u'id': u'6002839660079', u'name': u'Cosmetics'} .... ] 

In [5]: print interests_targeting.options()  ## 取AdSet 的 interests 的 targeting 設定 "Array of objects with 'id' and 'name' fields. eg; 'interests':[{id: 6003139266461, 'name': 'Movies'}]"
[{'name': u'Cosmetics', 'value': {'id': u'6002839660079', 'name': u'Cosmetics'}}, {'name': u'Science', 'value': {'id': u'6002866718622', 'name': u'Science'}} ... ]

search 就是 search api 後的result

option 就是把search 後的結果取出 adset targeting 設定的部分, 並做成[{name:name, value:value}, ..] 方便做option

get_type():

>>> import facebook_ads_targetings
>>> facebook_ads_targetings.get_types()

django-facebook-ads-targetings's People

Contributors

rasca0027 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.