From 38353c612a4f74c455d58efc2fcb21a309bfb378 Mon Sep 17 00:00:00 2001 From: Brinn Date: Fri, 31 Mar 2017 00:44:30 -0400 Subject: [PATCH] added twitter tracking pixel --- twitter_ads/account.py | 6 ++++++ twitter_ads/pixel.py | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 twitter_ads/pixel.py diff --git a/twitter_ads/account.py b/twitter_ads/account.py index 6b9e170..4f16fcb 100644 --- a/twitter_ads/account.py +++ b/twitter_ads/account.py @@ -136,6 +136,12 @@ def media_creatives(self, id=None, **kwargs): """ return self._load_resource(MediaCreative, id, **kwargs) + def pixel(self, id=None, **kwargs): + """ + Returns a collection of pixels (web_event_tags) available to the current account. + """ + return self._load_resource(Pixel, id, **kwargs) + def scoped_timeline(self, *id, **kwargs): """ Returns the most recent promotable Tweets created by the specified Twitter user. diff --git a/twitter_ads/pixel.py b/twitter_ads/pixel.py new file mode 100644 index 0000000..2878a3b --- /dev/null +++ b/twitter_ads/pixel.py @@ -0,0 +1,25 @@ +from twitter_ads.enum import TRANSFORM +from twitter_ads.resource import resource_property, Resource, Persistence, Batch, Analytics +from twitter_ads.http import Request +from twitter_ads.cursor import Cursor + +class Pixel(Resource, Persistence): + + PROPERTIES = {} + + RESOURCE_COLLECTION = '/1/accounts/{account_id}/web_event_tags' + RESOURCE = '/1/accounts/{account_id}/web_event_tags/{id}' + +# read only +resource_property(Pixel, 'embed_code', readonly=True) +resource_property(Pixel, 'id', readonly=True) +resource_property(Pixel, 'status', readonly=True) +resource_property(Pixel, 'website_tag_id', readonly=True) + +#writeable +resource_property(Pixel, 'account_id') +resource_property(Pixel, 'name') +resource_property(Pixel, 'click_window') +resource_property(Pixel, 'view_through_window') +resource_property(Pixel, 'type') +resource_property(Pixel, 'retargeting_enabled')