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
### Tasks
- [ ] https://github.com/woocommerce/pinterest-for-woocommerce/issues/697
- [ ] https://github.com/woocommerce/pinterest-for-woocommerce/issues/699
- [ ] Implement other methods in MarketingChannelInterface and register as a channel
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 Pinterest 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 Pinterest or the synch is in progress.
The ProductSync::is_product_sync_enabled method can be used to check if product syncing functionality is enabled. If it's not enabled, we can return the MarketingChannelInterface::PRODUCT_LISTINGS_NOT_APPLICABLE constant.
If product syncing is enabled, we would need to return either of these constants as the status:
MarketingChannelInterface::PRODUCT_LISTINGS_SYNC_IN_PROGRESS - If sync is still in progress.
MarketingChannelInterface::PRODUCT_LISTINGS_SYNC_FAILED - In case there are errors when syncing the products.
MarketingChannelInterface::PRODUCT_LISTINGS_SYNCED - If syncing the products has been successful.
The FeedState::get_feed_state method seems to be a good starting point for obtaining this information. However, the data structure returned by this method is custom-tailored to be used by the front end.
get_errors_count
This should return the number of errors/issues reported by Pinterest for the products and/or the account. This data can be obtained from the FeedState::get_feed_state method as well.
We can cache this data locally to prevent querying the Pinterest API whenever WooCommerce loads this information.
get_supported_campaign_types
This will define what types of marketing campaigns the Pinterest extension 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 pinterest-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
Specifies the marketing channel that his campaign type belongs to. If you define the types from within the class implementing the MarketingChannelInterface, then the channel should be set to $this.
Currently, there are two ad campaign types for Pinterest: Automatic and Manual. The user will be redirected to the Pinterest "Campaign creation page (https://ads.pinterest.com/advertiser/{ADS_ACCOUNT_ID}/ads/campaign_mode/), and they are presented with these two options to create campaigns:
get_campaigns
The list of all ad campaigns 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 the ad campaigns and then have a caching mechanism for the campaigns to store them locally. Pinterest provides the data we need about the ads through its APIs.
From pe2C5g-8v-p2#pinterest-for-woocommerce-github-wccom:
The campaigns themselves appear to include a name and a daily budget, but geo targeting seems to be less common (N/A could be displayed in the respective column (of) the MCM hub).
This issue has been blocked for a long time because of issues with the scope granted by Pinterest API auth (pcTzPy-vB-p2), so I'm moving it to the backlog.
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 Pinterest 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 Pinterest or the synch is in progress.
The
ProductSync::is_product_sync_enabled
method can be used to check if product syncing functionality is enabled. If it's not enabled, we can return theMarketingChannelInterface::PRODUCT_LISTINGS_NOT_APPLICABLE
constant.If product syncing is enabled, we would need to return either of these constants as the status:
MarketingChannelInterface::PRODUCT_LISTINGS_SYNC_IN_PROGRESS
- If sync is still in progress.MarketingChannelInterface::PRODUCT_LISTINGS_SYNC_FAILED
- In case there are errors when syncing the products.MarketingChannelInterface::PRODUCT_LISTINGS_SYNCED
- If syncing the products has been successful.The
FeedState::get_feed_state
method seems to be a good starting point for obtaining this information. However, the data structure returned by this method is custom-tailored to be used by the front end.get_errors_count
This should return the number of errors/issues reported by Pinterest for the products and/or the account. This data can be obtained from the
FeedState::get_feed_state
method as well.We can cache this data locally to prevent querying the Pinterest API whenever WooCommerce loads this information.
get_supported_campaign_types
This will define what types of marketing campaigns the Pinterest extension 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
.Currently, there are two ad campaign types for Pinterest: Automatic and Manual. The user will be redirected to the Pinterest "Campaign creation page (
https://ads.pinterest.com/advertiser/{ADS_ACCOUNT_ID}/ads/campaign_mode/
), and they are presented with these two options to create campaigns:get_campaigns
The list of all ad campaigns must be mapped to an array of
MarketingCampaign
objects and returned by this method. EachMarketingCampaign
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 the ad campaigns and then have a caching mechanism for the campaigns to store them locally. Pinterest provides the data we need about the ads through its APIs.
From pe2C5g-8v-p2#pinterest-for-woocommerce-github-wccom: