-
Notifications
You must be signed in to change notification settings - Fork 1
EP-4812: Refactor to Add Ads Enabled Option #183
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
base: master
Are you sure you want to change the base?
Conversation
| $this->organic->updateOption( | ||
| 'organic::enabled', | ||
| isset( $_POST['organic_enabled'] ) ? true : false, | ||
| false | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Enabled" will be offloaded to WordPress, i.e., plugin is activated or deactivated. If activated, we will now have more granular options about what, exactly, is enabled, e.g., Ads, Affiliate, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, see #183 (comment)
| public function __invoke( $args ) { | ||
| // Only both trying if the API key is set | ||
| if ( ! $this->organic->isEnabledAndConfigured() ) { | ||
| // Only worth trying if Ads is enabled and the API key is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Ads needs to be enabled, but maybe not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(E.g., maybe similar to Ads.txt redirect not needing Ads enabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it worth syncing to make sure we have config before enabling Ads
| $testEnabled = $organic->useSplitTest(); | ||
| return [ | ||
| 'organicEnabled' => $organic->isEnabledAndConfigured(), | ||
| 'organicEnabled' => $organic->isConfigured(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, a lot of Recurrent sites do have Organic WP plugin enabled and configured in WP, but the "integration" checkbox is disabled
That's because Organic Web has a hard dependency on Organic WP plugin GQL API and they can't just disable/delete the whole plugin
And by passing the $organic->isConfigured() as organicEnabled value will lead to injecting and setting up Organic SDK on those sites (even if Ads and Affiliate are disabled the Core is always enabled in the SDK)
https://github.com/orgnc/organic-content/blob/ae0c8844ae433483ac26300a8f8a2b8489490a19/frontend/packages/core/components/common/OrganicSDK/DocumentHeadOrganicTags.tsx#L184
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because Organic Web has a hard dependency on Organic WP plugin GQL API
Ah, ok, I see. I wonder if we can modify the language or add plugin field descriptions to make this all clearer? As a client looking at the settings page, I would be extremely confused. What does it mean for the integration to be enabled--isn't the plugin already active? If it's enabled but Ads, Affiliate, and Campaigns are not, then what is the plugin doing? Etc.
Tagging @cjkie here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance, I wonder if something like this taxonomy would work:
General Settings
- Organic API Key
- Organic Site ID
- Consent Management Program
- Prefill Containers Enabled
- AMP Enabled
- Inject Images into RSS Feed ...
- Automatically send plugin errors to Organic
SDK and Content Sync
- SDK enabled (automatically load the SDK on selected pages) [=
isEnabledfor Organic Web] - Which post types from your CMS should be ...
- Force content sync on Save ...
Organic Ads
- Ads.txt Redirect Enabled <-- Does not need Ads Enabled, but logically fits under Ads
- Organic Ads Enabled
Organic Affiliate
- Organic Affiliate Enabled
Organic Campaigns
- Organic Campaigns Enabled
| */ | ||
| public function useCmpBuiltIn() : bool { | ||
| return $this->isEnabled() && $this->cmp == 'built-in'; | ||
| return $this->adsEnabled() && $this->cmp == 'built-in'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMP can be used without Ads
| */ | ||
| public function useAmp() : bool { | ||
| return $this->isEnabledAndConfigured() && $this->ampEnabled; | ||
| return $this->useAds() && $this->ampEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Affiliate has AMP integration too
Overall I considered AMP and Prefill an plugin-level features, not something related to Ads or Affiliate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is prefill used outside of Ads?
| $ad_slots_prefill_enabled = $this->organic->getOption( 'organic::ad_slots_prefill_enabled' ); | ||
| $log_to_sentry = $this->organic->getOption( 'organic::log_to_sentry', true ); | ||
|
|
||
| $ads_enabled = $this->organic->getOption( 'organic::ads_enabled' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that after the plugin upgrade, the Ads will become disabled because the organic::ads_enabled field in DB will be empty
If the organic::ads_enabled is empty, we should pre-populate it based on behavior of previous versions of the plugin: if plugin/integration is enabled and configured, then set it to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, thank you!
| public function __invoke( $args ) { | ||
| // Only both trying if the API key is set | ||
| if ( ! $this->organic->isEnabledAndConfigured() ) { | ||
| // Only worth trying if Ads is enabled and the API key is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it worth syncing to make sure we have config before enabling Ads
This PR refactors our WP options and Admin panel:
We want to have an Ads Enabled option, and we want to separate certain tasks from Ads being enabled (e.g., allow Ads.txt redirect without Ads being enabled). Ticket here.
A few platform-side changes here: https://github.com/orgnc/platform/pull/3452.
I'm not done testing, but a review would be good.