Skip to content

Conversation

@obenland
Copy link
Member

@obenland obenland commented Aug 10, 2020

Takes inspiration from UpgradeNudge and BlockNudge to save the post and redirect to the checkout flow of the Business plan.

Reuses the following event:jetpack_editor_block_upgrade_click. We'll do a follow up PR for view event tracking.

Fixes #16781.

Changes proposed in this Pull Request:

  • Adds tracking for upgrade modal view and Upgrade link click
  • Autosaves current post and redirects to plan checkout flow for a business plan.

Does this pull request change what data or activity we track or use?

Similar to UpgradeNudge tracking.

Testing instructions:

  • follow setup steps from Social Preview: Add scaffolding for the feature #16615.

  • When testing on dotcom, make sure D48017-code is applied. No longer required as now in Production.

  • this PR currently shows both paid and unpaid versions of the sidebar. Click the one with If tested on local Jetpack Plugin, you will need to comment out social-previews here in order to activate the "upgrade nudge".

  • Click the "Learn More" button and it opens up this upgrade nudge

  • Click on "Upgrade" to see the post being saved before being redirected to the checkout flow.

  • Additionally, confirm that both events are recorded when you do this flow:

Set the debug with localStorage.setItem( 'debug', 'dops:analytics*' );

dops:analytics Record event "jetpack_editor_block_upgrade_nudge_impression" called with props {"plan":"business-bundle","block":"social-previews","blog_id":"60487750"} +1ms
dops:analytics Record event "jetpack_editor_block_upgrade_click" called with props {"plan":"business-bundle","block":"social-previews","blog_id":"60487750"} +0ms

ProTip: Preserv the log in order to see the second event when the redirect happens.

Screen Shot 2020-08-14 at 9 34 35 AM

Proposed changelog entry for your changes:

  • Not needed.

@obenland obenland added [Type] Task [Status] Needs Tracks Review Added/removed/modified a tracks event. [Status] Needs Team Review Obsolete. Use Needs Review instead. [Block] Social Previews labels Aug 10, 2020
@obenland obenland requested review from a team and marekhrabe August 10, 2020 22:37
@obenland obenland self-assigned this Aug 10, 2020
@obenland obenland linked an issue Aug 10, 2020 that may be closed by this pull request
Copy link
Contributor

@retrofox retrofox left a comment

Choose a reason for hiding this comment

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

Could we prioritize reviewing this PR before these changes? This PR adds and getUpgradeUrl() helper among other changes. If not, it seems we are going to overlap efforts.

@retrofox
Copy link
Contributor

retrofox commented Aug 11, 2020

Could we prioritize reviewing this PR before these changes? This PR adds and getUpgradeUrl() helper among other changes. If not, it seems we are going to overlap efforts.

Thinking well not sure about :this: I guess getting the getUpgradeUrl() ready to use could simplify the approach 🤷

@marekhrabe marekhrabe force-pushed the add/social-preview-modal-upgrade-nudge branch from 18a129a to 8ebc9b2 Compare August 11, 2020 09:59
Base automatically changed from add/social-preview-modal-upgrade-nudge to add/social-preview-modal August 11, 2020 10:00
@marekhrabe marekhrabe force-pushed the add/upgrade-path-social-previews branch 2 times, most recently from 946ab9a to d185e84 Compare August 11, 2020 11:26
marekhrabe
marekhrabe previously approved these changes Aug 11, 2020
Copy link
Contributor

@marekhrabe marekhrabe left a comment

Choose a reason for hiding this comment

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

I have fixed one tiny detail - the tracking call was done directly in the render function and that means it was easily called 5 times instead of once. I have wrapped it in an effect and now it's only called once per component lifecycle.

This works well for me now. Can you provide more detail @retrofox about the concerns you mentioned? I'm not entirely sure where you are heading or whether they are still relevant. Let me know so we can either proceed with this PR or plan a change.

@marekhrabe marekhrabe force-pushed the add/social-preview-modal branch from 551b04a to 0f70853 Compare August 11, 2020 13:43
@marekhrabe marekhrabe force-pushed the add/upgrade-path-social-previews branch from 9aaa4fe to a8d6905 Compare August 11, 2020 14:05
Base automatically changed from add/social-preview-modal to master August 12, 2020 11:37
@marekhrabe marekhrabe dismissed their stale review August 12, 2020 11:37

The base branch was changed.

Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

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

This is coming together! 👍

Did a quick code review. Noticed some minor things.

Also, this PR is quite difficult to review because it contains lots of changes that seem unrelated to this PR 🤷

We should probably rebase this now right?

@obenland obenland force-pushed the add/upgrade-path-social-previews branch 2 times, most recently from 9037f1c to f431f4c Compare August 13, 2020 17:07
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello obenland! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D48106-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@jetpackbot
Copy link
Collaborator

jetpackbot commented Aug 13, 2020

Warnings
⚠️

pre-commit hook was skipped for one or more commits

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16797

Generated by 🚫 dangerJS against bf679c7

@obenland
Copy link
Member Author

@getdave Thanks for you review! I rebased the PR and addressed most of your feedback. I think this is ready for another round.

@obenland obenland requested review from getdave and marekhrabe August 13, 2020 17:36
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. [Status] Needs Tracks Review Added/removed/modified a tracks event. labels Aug 18, 2020
@jeherve jeherve added this to the 8.9 milestone Aug 18, 2020
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.

Looking good. 🚢

@marekhrabe marekhrabe merged commit 6c96170 into master Aug 18, 2020
@marekhrabe marekhrabe deleted the add/upgrade-path-social-previews branch August 18, 2020 12:55
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Aug 18, 2020
@marekhrabe
Copy link
Contributor

r212283-wpcom

pereirinha pushed a commit that referenced this pull request Sep 10, 2020
* [not verified] Social Previews: Add upgrade path

Takes inspiration from `UpgradeNudge` and `BlockNudge` to save the post and redirect to the checkout flow of the Business plan.

* [not verified] fix repeated call of tracking

* Address PR feedback

Props @getdave.

* use-upgrade-flow: first approach

* plan-utils: add getUpgradeUrl() helper fn

* social-preview: refact -> use useUpgradeFlow hook

* Use Jetpack_Editor_Initial_State as source of truth

* use-upgrade-flow: Add "isRedirecting" feature, to prevent multiple clicks on button

This was added in the premium blocks branch `feature/premium-blocks` and
brings it inline with that version.  You can use the new `isRedirecting`
boolean to disable the button to provide visual feedback.

* social-preview upgrade: Give visual feedback when redirecting

* use-upgrade-flow: set async callback fn

* social-preview: do not track nudge event

* Use required_plan for click tracking

Also simplifies button text and updates the way required_plan is extracted.

* Avoid snake case

* Run prettier

* getUpgradeUrl: minor documentation fix (no functional changes)

Co-authored-by: Marek Hrabe <[email protected]>
Co-authored-by: retrofox <[email protected]>
Co-authored-by: Matthew Reishus <[email protected]>
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.

(3P) Social Previews: Set upgrade button link location

9 participants