Ejemplo n.º 1
0
def create_ad_conversion_pixel(params={}):
    pixel = AdConversionPixel(parent_id=test_config.account_id)
    pixel[AdConversionPixel.Field.name] = unique_name('Conversion Pixel')
    pixel[AdConversionPixel.Field.tag] = 'checkout'
    pixel.update(params)
    pixel.remote_create()

    atexit.register(remote_delete, pixel)

    return pixel
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# 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 examples.docs import fixtures

pixel_id = fixtures.create_ad_conversion_pixel().get_id()

# !_DOC [pruno]
# _DOC open [ADCONVERSIONPIXEL_UPDATE_VALUE]
# _DOC vars [pixel_id]
from facebookads.objects import AdConversionPixel

pixel = AdConversionPixel(pixel_id)
pixel[AdConversionPixel.Field.value] = 150
pixel.remote_update()
# _DOC close [ADCONVERSIONPIXEL_UPDATE_VALUE]
# 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 facebookads import test_config

ad_account_id = test_config.account_id

# !_DOC [pruno]
# _DOC open [ADCONVERSIONPIXEL_CREATE]
# _DOC vars [ad_account_id:s]
from facebookads.objects import AdConversionPixel

pixel = AdConversionPixel(parent_id=ad_account_id)
pixel.update({
    AdConversionPixel.Field.name: 'Conversion Pixel Name',
    AdConversionPixel.Field.tag: 'checkout',
})
pixel.remote_create()
# _DOC close [ADCONVERSIONPIXEL_CREATE]

pixel.remote_delete()