Last active
July 9, 2019 21:26
-
-
Save nicogaspa/0b376887fb12647d880a6b6cf94b6f99 to your computer and use it in GitHub Desktop.
simple class with function to create an offline event set using facebook python sdk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from facebook_business.adobjects.offlineconversiondataset import OfflineConversionDataSet | |
from facebook_business.api import FacebookAdsApi | |
class FacebookService: | |
def __init__(self): | |
self.api = FacebookAdsApi.init(app_id='your_app_id', app_secret='your_app_secret', | |
access_token='your_access_token') | |
def create_offline_event_set(self, name): | |
params = { | |
'enable_auto_assign_to_accounts': True, | |
'name':'test_event_set', | |
'description':'this is an example dataset' | |
} | |
response = OfflineConversionDataSet().api_create('account_id', params=params) | |
return response['id'] # This will be the dataset ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment