コード例 #1
0
    def execute(self):
        params = self.get_params()

        response = AdsPixel(self.__pixel_id).create_event(
            fields=[],
            params=params,
        )
        event_response = EventResponse(events_received=response['events_received'],
                                       fbtrace_id=response['fbtrace_id'],
                                       messages=response['messages'])
        return event_response
コード例 #2
0
    def execute(self):
        params = self.get_params()

        if self.__http_client is not None:
            return self.execute_with_client(params)

        response = AdsPixel(self.__pixel_id).create_event(
            fields=[],
            params=params,
        )
        event_response = EventResponse(events_received=response['events_received'],
                                       fbtrace_id=response['fbtrace_id'],
                                       messages=response['messages'])
        return event_response
コード例 #3
0
ファイル: event_request.py プロジェクト: Ge0f3/AdOps-Tech
    def execute(self):

        params = {"data": self.normalize()}

        if self.test_event_code is not None:
            params['test_event_code'] = self.test_event_code

        response = AdsPixel(self.__pixel_id).create_event(
            fields=[],
            params=params,
        )
        event_response = EventResponse(events_received=response['events_received'],
                                       fbtrace_id=response['fbtrace_id'],
                                       messages=response['messages'])
        return event_response
# Facebook.

# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.adobjects.business import Business
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<PIXEL_ID>'
FacebookAdsApi.init(access_token=access_token)

fields = []
params = {}
print AdsPixel(id).get_share_d_agencies(
    fields=fields,
    params=params,
)
コード例 #5
0
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<ADS_PIXEL_ID>'
FacebookAdsApi.init(access_token=access_token)

fields = []
params = {
    'data': [{
        'event_name': 'PageView',
        'event_time': 1569260711,
        'user_data': {
            'fbc':
            'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890',
            'fbp':
            'fb.1.1558571054389.1098115397',
            'em':
            '309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd'
        }
    }],
}
print AdsPixel(id).create_event(
    fields=fields,
    params=params,
)
コード例 #6
0
# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<ID>'
FacebookAdsApi.init(access_token=access_token)

fields = [
    'code',
]
params = {}
print AdsPixel(id).get(
    fields=fields,
    params=params,
)
コード例 #7
0
# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<PIXEL_ID>'
FacebookAdsApi.init(access_token=access_token)

fields = []
params = {
    'business': '<businessID>',
}
print AdsPixel(id).get_shared_accounts(
    fields=fields,
    params=params,
)
# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from facebook_business.adobjects.adspixel import AdsPixel
from facebook_business.api import FacebookAdsApi

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<PIXEL_ID>'
FacebookAdsApi.init(access_token=access_token)

fields = []
params = {
    'account_id': '<adAccountID>',
    'business': '<businessID>',
}
print AdsPixel(id).create_share_d_account(
    fields=fields,
    params=params,
)
コード例 #9
0
                "content_ids": ["product.id.123"],
                "content_type": "product",
            },
            "data_processing_options": [],
            "action_source": "website",
            "opt_out": "false",
        }
    ]
}

# to see events in events manager's test live events tool
if len(test_event_code) > 0:
    params["test_event_code"] = test_event_code

func_call = AdsPixel(pixel_id).create_event(
    fields=fields,
    params=params,
)

print(func_call)

# Output:
# <AdsPixel> {
#     "events_received": 1,
#     "fbtrace_id": "AhZex4M7cOQtj-zvlyDsHFi",
#     "messages": []
# }

# Check events here:
# https://business.facebook.com/events_manager2/list/pixel/351725288935559/test_events?business_id=269028820483935&act=288563226

# API doc here: