Skip to content
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

[HOLD] feat: default segments #809

Closed
wants to merge 7 commits into from
Closed

[HOLD] feat: default segments #809

wants to merge 7 commits into from

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Feb 23, 2022

All Submissions:

Changes proposed in this Pull Request:

Starts the "reasonable defaults" part of the roadmap. Allows site admins to generate a set of default segments with a button click. If they've already been created and edited, clicking the button will restore the default segments to the default configuration.

The reason for requiring some kind of user action (in this case a button click) is to accommodate sites that may have been up and running with Campaigns for a while now—we don't want to automatically generate new segments which may conflict with existing segments that are running live prompts.

Closes #673.

How to test the changes in this Pull Request:

Before testing, make sure your Newspack Plugin is running Automattic/newspack-plugin#1524.

  1. On a fresh or existing site, visit Newspack > Campaigns > Segments. Confirm there's a new button at the bottom of the segments list:

Screen Shot 2022-02-22 at 5 04 31 PM

  1. Click the button. Confirm you see a modal with a bit of explanation of what you're doing (@aschweigert: could use your help with reviewing/updating this copy):

Screen Shot 2022-02-22 at 5 15 15 PM

  1. Click "OK". Confirm that a set of default segments (with prefix "[Newspack]") is generated. If you already had existing segments on the site, confirm that the default segments are generated with lower priority than the existing segments.
  2. Edit some of the default segment names and settings, and reshuffle the priority. Delete at least one default segment.
  3. Click "Reset default segments" and click "OK". Confirm that:
  • All existing segments retain their sorted priority
  • The default segment(s) you edited are now reverted to their original names and settings
  • The default segment(s) you deleted are restored

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

…h a click

Starts the "reasonable defaults" part of the roadmap. Allows site admins to generate a set of
default segments with a button click. If they've already been created and edited, clicking the
button will restore the default segments to the default configuration.

#674
@dkoo dkoo self-assigned this Feb 23, 2022
@dkoo dkoo added enhancement New feature or request Feature request [Status] Needs Review and removed enhancement New feature or request labels Feb 23, 2022
@dkoo dkoo added this to the 2 - Better defaults milestone Feb 23, 2022
@dkoo dkoo requested a review from aschweigert February 23, 2022 00:19
@dkoo dkoo changed the title feat(segments): add ability to generate or reset default segments wit… feat: default segments Feb 23, 2022
@dkoo dkoo marked this pull request as ready for review February 23, 2022 00:24
@dkoo dkoo requested a review from a team as a code owner February 23, 2022 00:24
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for requiring some kind of user action (in this case a button click) is to accommodate sites that may have been up and running with Campaigns for a while now—we don't want to automatically generate new segments which may conflict with existing segments that are running live prompts.

What if there are no segments on the site – should defaults be set up then? This would be a surprise in the "Campaigns" tab, but there would be no disruption to the existing campaigns setup. WDYT @dkoo @aschweigert ?

image

includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
@dkoo
Copy link
Contributor Author

dkoo commented Feb 23, 2022

What if there are no segments on the site – should defaults be set up then? This would be a surprise in the "Campaigns" tab, but there would be no disruption to the existing campaigns setup. WDYT @dkoo @aschweigert ?

I can get behind this. Maybe if there are no segments AND no active prompts? This would avoid creating confusion for sites that may have active prompts running for "everyone" and don't intend to use the segmentation features.

EDIT: further, we could trigger the auto-generation when you navigate to the Campaigns wizard, this way we could show a short message explaining what happened. And if a site admin never visits Campaigns, we don't need to run the extra functions.

@dkoo dkoo requested a review from adekbadek February 23, 2022 21:55
@dkoo
Copy link
Contributor Author

dkoo commented Feb 23, 2022

@adekbadek I pushed some changes to address your feedback. I think the auto-generation we're discussing can probably live in the main plugin if we trigger it upon rendering the Campaigns wizard.

],
],
'everyone_else' => [
'name' => __( ' Other Readers', 'newspack-popups' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: there are extra leading spaces in the segments names:

Suggested change
'name' => __( ' Other Readers', 'newspack-popups' ),
'name' => __( 'Other Readers', 'newspack-popups' ),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed in 86337ae.

includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
@adekbadek
Copy link
Member

Maybe if there are no segments AND no active prompts? This would avoid creating confusion for sites that may have active prompts running for "everyone" and don't intend to use the segmentation features.

Adding the default segments won't disrupt their prompt delivery in any way, and I think the user should be encouraged to make use of segmentation. So I'd say the defaults should be created if there are no segments, regardless of whether there are prompts.

we could trigger the auto-generation when you navigate to the Campaigns wizard, this way we could show a short message explaining what happened. And if a site admin never visits Campaigns, we don't need to run the extra functions.

Seems to me it'd be simpler to create the default segments on WP initialisation, without the extra API call. But it's not a strong opinion.

@dkoo
Copy link
Contributor Author

dkoo commented Feb 24, 2022

a315d73 implements the auto-generation if the site doesn't have any segments.

@dkoo dkoo requested a review from adekbadek February 24, 2022 18:56
includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
includes/class-newspack-popups-segmentation.php Outdated Show resolved Hide resolved
@dkoo dkoo requested a review from adekbadek February 25, 2022 16:49
@dkoo
Copy link
Contributor Author

dkoo commented Feb 25, 2022

Note to @thomasguillot: after some discussion we've decided we'd like to build this out into a more guided onboarding/wizard experience to guide users toward one of several sets of default segments, based on their input. @aschweigert will work on a suggested flow for this, but let's hold these changes until we can flesh that out a bit more.

@dkoo dkoo changed the title feat: default segments [HOLD] feat: default segments Feb 25, 2022
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving in the current state – as noted above it's likely to change, though.

@dkoo
Copy link
Contributor Author

dkoo commented Apr 11, 2022

After some internal discussion we're going to be moving in a different direction for this. I'm going to close this for now—we can reopen if we change our minds about wanting to release it as an interim step.

@dkoo dkoo closed this Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide base campaign segments (or just good docs) by user journey
2 participants