-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Plugin Detection Logic to Ads Module Backend Infrastructure #10169
Comments
Thanks @10upsimon AC ✅ |
Let's name this class to be
Starting point for what?
This method should be called
We should add a new method
Let's also add classes that we need to update to use the new approach of detecting whether a plugin is active (and bump estimates accordingly). It should include the consent mode mentioned briefly in IB, plus SiwG and ACR classes that check whether WooCommerce is active. |
Thanks @eugene-manuilov , IB updated |
Thanks. IB ✔ |
Noting for reviewers and QA etc, that we had to shift direction and instead include the plugins base data in the This of course poses a problem for those issues depending on this issue, as we need to be aware of the plugin status regardless of ads being connected. Changes therefore include the following:
|
Also adding, cc @zutigrm , that this did not seem necessary during execution:
|
Feature Description
In order for the WooCommerce redirect logic to be correctly implemented across all areas of the epic, the core foundation of the feature - which is plugin detection - should be implemented with the Ads module backend infrastructure. This logic will aid surfacing of specific plugin related information, name for the the following plugins (including the details for each):
The status of each of the above plugins is to be surfaced in a new
plugins
object with theads
module base data. Therefore, plugin detection logic may reside in the mainAds.php
file atincludes/Modules/Ads.php
.Logic for detecting the presence and active/inactive state for each plugin can be borrowed from the
Developer_Plugin_Installer
class atincludes/Core/Util/Developer_Plugin_Installer.php
. This new logic should likely reside within a new plugin detection class, generic or specific to the WooCommerce body of work, whichever is more fitting.This section is detailed in the design document under the sub heading "Infrastructure > Plugin Detection".
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
adsPax
feature flag is enabled, theads
module base data should be extended to contain a newplugins
object with the following entries for each:woocommerce
- To hold installation and active/inactive status of the WooCommerce plugin using the following properties:active
- Boolean, whether the plugin is active or notinstalled
- Boolean, whether the plugin is installed or notgoogle-listings-and-ads
- To hold installation status, active/inactive status and linked Ads account status of the Google for WooCommerce plugin using the following properties:active
- Boolean, whether the plugin is active or notinstalled
- Boolean, whether the plugin is installed or notadsConnected
- Boolean, whether an existing Ads account has been linked to Google for WooCommerceImplementation Brief
includes/Core/Util/Plugin_Status.php
installed
,activated
, andnot-installed
get_plugin_status
, which can accept 2 arguments:plugin_path
, andplugin_url
.is_plugin_active
core function withplugin_path
argument to check for active status and you can re-use this implementation to adapt for checking theinstalled
statussite-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 200 to 216 in aaa172c
is_plugin_active
andget_plugins
needplugin.php
fromwp-admin/includes
folderinstalled
,activated
ornot-installed
string.get_plugin_file
to extract the$plugin_file
- check the example heresite-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Lines 208 to 211 in aaa172c
Google\Site_Kit\Modules\Ads::inline_modules_data
method:adsPax
feature flag is enabled expand the existing$modules_data['ads']
array to include:woocommerce
key, which should hold sub-array with following values:active
andinstalled
keys with the boolean values based on the return fromPlugin_Status::get_plugin_status
methodwoocommerce/woocommerce.php
forplugin_path
andhttps://woocommerce.com/
asplugin_url
argumentgoogle-listings-and-ads
key, which should hold sub-array with following values:active
andinstalled
- same like above, use boolean values based on the returned values from util class, by passing thegoogle-listings-and-ads/google-listings-and-ads.php
asplugin_path
, andhttps://wordpress.org/plugins/google-listings-and-ads
asplugin_url
argadsConnected
- ifgla_ads_id
option is not empty, returntrue
site-kit-wp/includes/Core/Consent_Mode/REST_Consent_Mode_Controller.php
Line 189 in aaa172c
Google\Site_Kit\Core\Conversion_Tracking\Conversion_Event_Providers\WooCommerce::is_active
method to use new util for checking if plugin is activeincludes/Modules/Sign_In_With_Google.php
, replace the usage ofWooCommerce
class from conversion events infrastructure and it's method$this->woocommerce->is_active()
to use new util class directly, and also this checksite-kit-wp/includes/Modules/Sign_In_With_Google.php
Line 329 in aaa172c
activated
Test Coverage
tests/phpunit/integration/Modules/AdsTest.php
to include new inline data in testsPlugin_Status
QA Brief
QA Involves testing this body of work, as well as smoke testing Sign in With Google WooCommerce functionality, as well as Consent Mode plugin installation.
adsPax
feature flag enabled, set up GA4 at least as we'll need to smoke test Consent Mode as well_googlesitekitBaseData.plugins
Changelog entry
The text was updated successfully, but these errors were encountered: