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

Mailchimp Block: Interests/SIGNUP merge field/AMP state hook #14050

Merged
merged 15 commits into from
Nov 22, 2019

Conversation

jeffersonrabb
Copy link
Contributor

@jeffersonrabb jeffersonrabb commented Nov 15, 2019

Introduces a few new features to the Mailchimp block:

  • Support for Audience Groups. These allow subscribers to be grouped based on their interests, which allows for superior communication and segmentation. Mailchimp charges by the subscriber, so it's more cost effective to maintain one list with multiple groups as opposed to creating separate groups for topics. Also, the WPCOM Mailchimp implementation currently supports only one list per site.
  • Support for a SIGNUP merge field which is used to know where a subscriber came from.
  • AMP State. After a successful signup AMP state will be updated. This is needed by the Newspack Pop-ups block, to enable the logic that suppresses pop-ups if the current user has already subscribed.

Preparation

  • This PR must be tested with D35074-code.
  • You will need a WPCOM sandbox sandboxed for Jetpack development, since this PR uses Client::wpcom_json_api_request_as_blog()
  • You will need a Mailchimp account.
  • Local Jetpack instance will need to have the AMP plugin installed and in Transitional Mode.
  • Testing site will need a secure public URL.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

Discussion here: p1HpG7-7WS-p2

Testing instructions:

  • Create a Mailchimp account (if you don't have one already).
  • Create a List, and add some Groups. Documentation here: https://mailchimp.com/help/send-groups-audience/
  • [UPDATED 11.20] Set up a SIGNUP field following the instructions here. The name of the field must be "SIGNUP"
  • Apply D35074-code to WPCOM Sandbox, and be sure JETPACK__SANDBOX_DOMAIN is configured for Jetpack development.
  • Add Mailchimp block to a post, follow flow to connect the Mailchimp account and select the correct list.
  • In the Mailchimp block sidebar, verify you see a "Mailchimp Groups" pane with a checkbox for every group created in Mailchimp dashboard.
  • In Mailchimp block sidebar verify there is a "Merge Fields" pane with a single "Signup Location" field.
  • In "Mailchimp Groups" select one or more groups.
  • Set Signup location to an arbitrary value, e.g. "My Blog"
  • Publish the post and view the published page.
  • In a non-AMP request, subscribe. Verify the email appears on the list in the Mailchimp dashboard and that it is in the correct groups and has the correct SIGNUP value.
  • In an AMP request (append ?amp to the URL), subscribe. Verify the email appears on the list in the Mailchimp dashboard and that it is in the correct groups and has the correct SIGNUP value.
  • To verify the AMP state elements, append ?amp#development=1 to the end of the URL and reload. In the console you should be able to execute AMP.printState() and get a valid response. Subscribe with a new email address. After success, execute AMP.printState() again. Verify the state contains mailing_list_status: "subscribed" and mailing_list_email: {SUBSCRIBED_EMAIL_ADDRESS}

Proposed changelog entry for your changes:

  • Support for Mailchimp Audience Groups.
  • Support for Mailchimp SIGNUP merge field.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello jeffersonrabb! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D35555-code before merging this PR. Thank you!

@jetpackbot
Copy link

jetpackbot commented Nov 15, 2019

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: December 3, 2019.
Scheduled code freeze: November 26, 2019

Generated by 🚫 dangerJS against 48f2038

@jeherve jeherve added [Block] Mailchimp [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Nov 18, 2019
@matticbot
Copy link
Contributor

jeffersonrabb, Your synced wpcom patch D35555-code has been updated.

@jeffersonrabb jeffersonrabb added AMP [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 18, 2019
@jeherve jeherve added this to the 8.0 milestone Nov 19, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

I gave it a quick test, and I have some questions. It seems to work well for me overall, and it doesn't bring existing forms either.

In "Mailchimp Groups" select one or more groups.

Should I be able to do that when I set it as "Dropdown / can only select one at a time" when I created the groups?

Verify the email appears on the list in the Mailchimp dashboard and that it is in the correct groups and has the correct SIGNUP value.

I could find the group info, but not the SIGNUP value. I am not sure where to check that when looking at my subscriber list.

extensions/blocks/mailchimp/mailchimp.php Outdated Show resolved Hide resolved
extensions/blocks/mailchimp/edit.js Outdated Show resolved Hide resolved
extensions/blocks/mailchimp/mailchimp.php Outdated Show resolved Hide resolved
extensions/blocks/mailchimp/edit.js Outdated Show resolved Hide resolved
@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 19, 2019
@jeffersonrabb
Copy link
Contributor Author

It seems to work well for me overall, and it doesn't bring existing forms either.

@jeherve quick confirmation - in the above, "bring" === "break"?

@jeffersonrabb
Copy link
Contributor Author

I could find the group info, but not the SIGNUP value. I am not sure where to check that when looking at my subscriber list.

I believe I missed a step here. The field has to be defined in Mailchimp following these instructions: https://mailchimp.com/help/determine-webpage-signup-location/

When set up successfully you should see the values in the subscriber list as in this screenshot:

Screen Shot 2019-11-20 at 8 07 21 AM

This makes me wonder if the block should also allow defining the field name, so we don't lock in to the name SIGNUP, but I'm reticent to add more complexity.

@jeherve
Copy link
Member

jeherve commented Nov 20, 2019

quick confirmation - in the above, "bring" === "break"?

Oh yes, sorry!

@jeherve
Copy link
Member

jeherve commented Nov 20, 2019

Thanks for the extra details.

This makes me wonder if the block should also allow defining the field name, so we don't lock in to the name SIGNUP, but I'm reticent to add more complexity.

Since this has to be set properly by the site owner first, it may indeed be nice to have matching fields in the block properties. On the plus side, this would also make it easier for non-english folks who may not understand nor want to have a "Signup" field.

@matticbot
Copy link
Contributor

jeffersonrabb, Your synced wpcom patch D35555-code has been updated.

jeherve
jeherve previously approved these changes Nov 21, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This works well. I think the links to Mailchimp are nice to give a bit more info. Since their docs are focussed on creating whole forms from their interface, I wonder if we should link to our own support docs to explain how to do this from the audience settings instead; I struggled a bit to get the fields to work in the first place, so I think some more detailed docs could help there.

Maybe we can ask for help from JPOP Quill and update the existing links once we have docs? What's your take on this?

I also have another comment, but I don't think that's blocking, that can be addressed in a future PR. Approving for now.

extensions/blocks/mailchimp/mailchimp.php Outdated Show resolved Hide resolved
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 21, 2019
@matticbot
Copy link
Contributor

jeffersonrabb, Your synced wpcom patch D35555-code has been updated.

@matticbot
Copy link
Contributor

jeffersonrabb, Your synced wpcom patch D35555-code has been updated.

@jeffersonrabb
Copy link
Contributor Author

Maybe we can ask for help from JPOP Quill and update the existing links once we have docs? What's your take on this?

That's a good idea. I'll follow up on this after this lands and we can roll this improvement into future work on the block.

@jeffersonrabb jeffersonrabb added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Nov 21, 2019
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 22, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This should be good to merge now. 👍

@jeherve jeherve added the [Status] Needs Testing We need to add this change to the testing call for this month's release label Nov 22, 2019
@jeffersonrabb jeffersonrabb merged commit f95b51a into master Nov 22, 2019
@jeffersonrabb jeffersonrabb deleted the add/mailchimp-groups-merge-fields branch November 22, 2019 17:19
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Nov 22, 2019
@jeherve jeherve added [Status] Has Changelog and removed [Status] Needs Changelog [Status] Needs Testing We need to add this change to the testing call for this month's release labels Nov 25, 2019
jeherve added a commit that referenced this pull request Nov 25, 2019
jeherve added a commit that referenced this pull request Nov 25, 2019
* 8.0 Release: running changelog

* Changelog: add #13921

* Changelog: add #13980

* Changelog: add #13905

* Changelog: add #13971

* Changelog: add #13984

* Changelog: add #14009

* Changelog: add #13620

* Remove things that will ship in 7.9.1

* Changelog: add 7.9.1 release (#14044)

* Changelog: add base for 7.9.1 release

* Update release date and post link

* Changelog: add #14066

* Update changelog for 7.9.1

* Changelog: add #13405

* Changelog: add #13841

* Changelog: add #13924

* Changelog: add #13986

* Changelog: add #14010, #14028, #14053, #14055.

* Changelog: add #14054

* Changelog: add #14031

* Changelog: add #14039

* Changelog: add #14050

* Changelog: add #14070

* Changelog: add #14082

* Changelog: add #14084

* Changelog: add #14111

* Changelog: add #13961

* Changelog: add #14047

* Changelog: add #14091

* Changelog: add #14108

* Changelog: add #14121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AMP [Block] Mailchimp [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants