The new multichannel marketing dashboard is being implemented in WooCommerce (https://github.com/woocommerce/woocommerce/issues/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 the MarketingChannels class. The implementation of MarketingChannelInterface 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 the upload_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:
Property Name
Property Type
Description
id
string
A unique identifier for the campaign type. For example: facebook-ads
name
string
Name of the marketing campaign type.
description
string
Description of the marketing campaign type.
create_url
string
The URL to the create campaign page.
icon_url
string
The URL to an image/icon for the campaign type.
channel
MarketingChannelInterface
The marketing channel that this campaign type belongs to. If you are defining the types from within the class implementing the 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:
Property Name
Property Type
Description
id
string
The unique identifier of the marketing campaign.
title
string
The title of the campaign.
manage_url
string
The URL to the channel’s campaign management page.
cost
Price
The cost of the campaign. This should be an object of the type Price.
type
MarketingCampaignType
The type of this marketing campaign. It should match one of the supported types returned by the 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.
Names are available on the Campaign level (documentation), while budget and geo targets are available on the Ad Set level (documentation). For the proposed structured row format, the Facebook campaigns could either display the name only, or include target countries and budget (although that information would have to be collated from each campaign’s ad sets).
The new multichannel marketing dashboard is being implemented in WooCommerce (https://github.com/woocommerce/woocommerce/issues/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: