Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Mwindo
Copy link
Contributor

@Mwindo Mwindo commented Jun 29, 2023

This PR refactors our WP options and Admin panel:

Screen Shot 2023-07-05 at 12 59 50 PM

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.

Comment on lines -80 to -84
$this->organic->updateOption(
'organic::enabled',
isset( $_POST['organic_enabled'] ) ? true : false,
false
);
Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor Author

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?

Copy link
Contributor Author

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)

Copy link
Contributor

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

@Mwindo Mwindo requested a review from sergunich July 5, 2023 17:09
@Mwindo Mwindo marked this pull request as ready for review July 5, 2023 17:09
$testEnabled = $organic->useSplitTest();
return [
'organicEnabled' => $organic->isEnabledAndConfigured(),
'organicEnabled' => $organic->isConfigured(),
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@Mwindo Mwindo Jul 6, 2023

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) [= isEnabled for 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';
Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Contributor Author

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' );
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

@Mwindo Mwindo marked this pull request as draft July 6, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants