Integrate with Multichannel Marketing #2443
Labels
feature: ads
Related to buying and managing Facebook ads.
feature: product sync
Relating to syncing product data to Facebook.
status: blocked
The issue is blocked from progressing, waiting for another piece of work to be done.
type: task
The issue is an internally driven task (e.g. from another A8c team).
The new multichannel marketing dashboard is being implemented in WooCommerce (woocommerce/woocommerce#34548) and will be released soon. For this extension to be recognized as a marketing channel and be displayed on that dashboard, we need to implement an integration with the interfaces/classes introduced in the WooCommerce core.
Details on implementing this integration are currently available here: pe2C5g-zb-p2
In short, we need to implement the
MarketingChannelInterface
in the code base and register an instance using theMarketingChannels
class. The implementation ofMarketingChannelInterface
will return information about the Facebook marketing channel, such as its name, descriptions, setup_url, icon, etc., and WooCommerce will display this information to the user on the new multichannel marketing dashboard.Most of the data returned by the
MarketingChannelInterface
methods are straightforward to gather and implement. However, returning the following data might be more complicated:get_product_listings_status
This will return whether the product listings are synchronized with Facebook or the synch is in progress.
One way to get this information is to check whether there are any pending product sync jobs. The
\WooCommerce\Facebook\Products\Sync::is_sync_in_progress
method will return true if there any pending jobs.Another method is to check if the product feed has been uploaded successfully and there were no errors. The
\WC_Facebook_Product_Feed::is_upload_complete
method will check the status of the product feed. However, this method does not seems to be working properly because at the moment the extension does not store theupload_id
for the feed.get_errors_count
This should return the number of errors/issues reported by Facebook for the products and/or account. Meta already provides an API to get the product feed errors here. However, to get the account related errors we need to utilize a different method.
To prevent querying the Facebook API everytime this information is loaded by WooCommerce, we can cache this data locally.
get_supported_campaign_types
This will define what types of marketing campaigns the Facebook plugin supports. It should return an array of
MarketingCampaignType
objects that define the following properties:id
string
name
string
description
string
create_url
string
icon_url
string
channel
MarketingChannelInterface
MarketingChannelInterface
, then the channel should be set to $this.The supported campaign types can be the following list as presented to the user when they try to create a new ad campaign:
However, since all campaigns are created on Facebook (and not on the extension), we need to be able to link directly to the page that creates each ad type. If that's not possible, we can create one generate campaign type and provide a link to the Facebook's "Create Ad" page.
get_campaigns
The list of all ad campaign must be mapped to an array of
MarketingCampaign
objects and returned by this method. Each MarketingCampaign object has the following properties:id
string
title
string
manage_url
string
cost
Price
type
MarketingCampaignType
MarketingChannelInterface::get_supported_campaign_types
Since the extension does not store any of the ad campaigns locally, we need to implement connections to the API to retrieve the list of ad campaign and then have a caching mechanism for the campaigns to store them locally. Facebook provides data that we need about the ads through different APIs.
From pe2C5g-8v-p2#facebook-for-woocommerce:
The text was updated successfully, but these errors were encountered: