Jump to content

Search the Community

Showing results for tags 'working in progress module'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi there, the idea of this module was born from the need to integrate FB API to bypass the block of reading data after the IOS14 update. FB tells us that in order to continue reading the data we have to send it via the API Convention. I wanted to publish this module finished, but I can't figure out how to do this. :( I don't know if anyone is willing to help me understand how to solve my problems. I'm trying to create a module with the Facebook SDK to send info via API. I attach here what I have done, at the moment, it is all very simple and rough. facebookSDK.zip At the moment the module works only as a link to the SDK folder and can be used to enter the credentials of the token and pixal via two variables. What I would like to do is to leave all the request to the SDK, in order to keep only the creation of objects in the page. Since the use cases are so many, I thought the best solution is to delegate to the module the connection with the SDK and keep in the page the creation of objects to be customized. Basically for the Convention API you need to make these objects UserData CustomData Event For let this module works fine, at moment, I have to add in to the page also the call to the SDK. So, in my page I have $fbSDK = $modules->get('facebookSDK'); use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; use FacebookAds\Object\ServerSide\Content; use FacebookAds\Object\ServerSide\CustomData; use FacebookAds\Object\ServerSide\DeliveryCategory; use FacebookAds\Object\ServerSide\Event; use FacebookAds\Object\ServerSide\EventRequest; use FacebookAds\Object\ServerSide\Gender; use FacebookAds\Object\ServerSide\UserData; // Configuration this all $time = time(); if (isset($_COOKIE['_fbc'])) {$fb_fbc = $_COOKIE['_fbc'];} // This data is always better to have if (isset($_COOKIE['_fbp'])) {$fb_fbp = $_COOKIE['_fbp'];} // This data is always better to have $access_token = $fbSDK->accessToken(); $pixel_id = $fbSDK->pixelId(); // Initialize Api::init(null, null, $access_token); $api = Api::instance(); $api->setLogger(new CurlLogger()); $events = array(); // Specific data only if need in the object $hashEmail = hash('sha256', $user->email); // some data need to be hashed with SHA256 and UTF-8 encoding $user_data_0 = (new UserData()) ->setEmail($hashEmail) ->setClientIpAddress($_SERVER['REMOTE_ADDR']) ->setClientUserAgent($_SERVER['HTTP_USER_AGENT']) ->setFbc($fb_fbc) ->setFbp($fb_fbp); $custom_data_0 = (new CustomData()) // all these data are optional, I only include them as an example ->setValue(str_replace(",", ".", $page->pad_price)) ->setCurrency("EUR") ->setContentName("API test") ->setContentIds($skuAPI_json) ->setContentType("product_group") ->setCustomProperties(array("product_catalog_id" => "111111111")); $event_0 = (new Event()) ->setEventName("ViewContent") ->setEventTime($time) ->setUserData($user_data_0) ->setCustomData($custom_data_0) ->setActionSource("website") ->setEventSourceUrl($page->url(true)); array_push($events, $event_0); $request = (new EventRequest($pixel_id)) ->setEvents($events); $request->execute(); I would like to bring all this part into the module: use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; use FacebookAds\Object\ServerSide\Content; use FacebookAds\Object\ServerSide\CustomData; use FacebookAds\Object\ServerSide\DeliveryCategory; use FacebookAds\Object\ServerSide\Event; use FacebookAds\Object\ServerSide\EventRequest; use FacebookAds\Object\ServerSide\Gender; use FacebookAds\Object\ServerSide\UserData; // Configuration. if (isset($_COOKIE['_fbc'])) {$fb_fbc = $_COOKIE['_fbc'];} if (isset($_COOKIE['_fbp'])) {$fb_fbp = $_COOKIE['_fbp'];} $access_token = $fbSDK->accessToken(); $pixel_id = $fbSDK->pixelId(); // Initialize Api::init(null, null, $access_token); $api = Api::instance(); $api->setLogger(new CurlLogger()); While keeping everything else on the page, so that it is customizable according to the needs of the moment.
×
×
  • Create New...