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

Adds route & sales page for Ultimate Traffic Guide #48154

Merged
merged 15 commits into from
Dec 21, 2020

Conversation

aneeshd16
Copy link
Contributor

@aneeshd16 aneeshd16 commented Dec 9, 2020

Changes proposed in this Pull Request

  • Adds a new card to the Marketing Tools tab
  • Clicking on the CTA in the card should navigate to the sales page for the Ultimate Traffic Guide

Testing instructions

Marketing tools card

  • Go to My Site -> Tools -> Marketing
  • Confirm that the card is visible only if the locale is English.
    image
  • If the user has purchased the traffic guide, the CTA should be "Download now". If not, it should be "Learn more".

Sales page

  • Click on the CTA on the Marketing tools card.
  • Ensure that the sales page renders correctly and the copy is correct.
    screenshot Image Link: https://d.pr/i/jOxhOq
  • Switch to treatment for the traffic_guide_copy_test experiment. The alternate copy should be shown. (This is currently broken) (works now)

Checkout

  • Clicking on the CTA should lead to the checkout page with the product added in cart
    screenshot Image Link: https://d.pr/i/S5o3ta
  • Once the purchase is complete, it should show a thank you page with a link to download
    screenshot Image Link: https://d.pr/i/Ognmt4
  • Clicking on the download CTA should download the file.

Download Page

  • Accessing the Traffic Guide page through the card should now show a Download page instead of the Sales page
    screenshot Image Link: https://d.pr/i/0ZR8sv

  • Clicking on the download CTA should download the file.

  • The purchase is per-user, so this behaviour should remain consistent irrespective of the site chosen.

@matticbot
Copy link
Contributor

</strong>
<br></br>
{ translate(
'It’s so effective you don’t even have to come close to a “perfect” site before you launch… even the ugliest site can drive an endless stream of business if you get this right!'
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 17 times:
translate( 'How to build a simple <b>“traffic magnet”</b> to instantly attract the right audience to your site and convert them to raving fans (It’s so effective you don’t even have to come close to a “perfect” site before you launch... even the ugliest site can drive an endless stream of business if you get this right!)' ) ES Score: 8

@matticbot
Copy link
Contributor

matticbot commented Dec 9, 2020

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~159 bytes added 📈 [gzipped])

name        parsed_size           gzip_size
entry-main       +631 B  (+0.0%)     +159 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~6382 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
marketing                 +11455 B  (+2.1%)    +3245 B  (+2.3%)
checkout                  +10410 B  (+0.7%)    +3122 B  (+0.9%)
woocommerce                 +467 B  (+0.0%)      +50 B  (+0.0%)
site-purchases              +467 B  (+0.0%)      +41 B  (+0.0%)
signup                      +467 B  (+0.1%)      +42 B  (+0.0%)
purchases                   +467 B  (+0.0%)      +42 B  (+0.0%)
plans                       +467 B  (+0.1%)      +42 B  (+0.0%)
export                      +467 B  (+0.2%)      +42 B  (+0.1%)
email                       +467 B  (+0.1%)      +42 B  (+0.0%)
domains                     +467 B  (+0.0%)      +44 B  (+0.0%)
customize                   +467 B  (+0.2%)      +42 B  (+0.1%)
themes                      +466 B  (+0.1%)      +41 B  (+0.0%)
theme                       +466 B  (+0.1%)      +41 B  (+0.0%)
settings-writing            +466 B  (+0.1%)      +41 B  (+0.0%)
settings-security           +466 B  (+0.1%)      +41 B  (+0.0%)
settings-performance        +466 B  (+0.1%)      +41 B  (+0.0%)
settings-jetpack            +466 B  (+0.2%)      +41 B  (+0.1%)
settings-discussion         +466 B  (+0.2%)      +41 B  (+0.1%)
settings                    +466 B  (+0.1%)      +41 B  (+0.0%)
jetpack-search              +466 B  (+0.3%)      +41 B  (+0.1%)
jetpack-connect             +466 B  (+0.1%)      +41 B  (+0.0%)
jetpack-cloud-pricing       +466 B  (+0.1%)      +44 B  (+0.0%)
home                        +466 B  (+0.1%)      +41 B  (+0.0%)
help                        +466 B  (+0.1%)      +41 B  (+0.0%)
activity                    +466 B  (+0.1%)      +41 B  (+0.0%)
account-close               +466 B  (+0.1%)      +41 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~138 bytes added 📈 [gzipped])

name                                                              parsed_size           gzip_size
async-load-calypso-blocks-editor-checkout-modal                        +505 B  (+0.0%)      +59 B  (+0.0%)
async-load-design-blocks                                               +466 B  (+0.0%)      +60 B  (+0.0%)
async-load-design                                                      +466 B  (+0.0%)      +41 B  (+0.0%)
async-load-calypso-my-sites-current-site-stale-cart-items-notice       +466 B  (+1.0%)      +41 B  (+0.4%)
async-load-calypso-blocks-inline-help-popover                          +466 B  (+0.1%)      +41 B  (+0.0%)
async-load-calypso-blocks-inline-help                                   +52 B  (+0.0%)      +19 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

</p>
<p>
{ translate(
'The Ultimate Traffic GuideThis is a goldmine of traffic tips and how-tos that reveals the exact “Breakthrough Traffic” process we’ve developed over the past decade.'
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 17 times:
translate( 'The Ultimate Traffic Guide is a goldmine of traffic tips and how-tos that reveals the exact “Breakthrough Traffic” process we’ve developed over the past decade.' ) ES Score: 12
See 2 additional suggestions in the PR translation status page

</p>
<p>
<Button onClick={ handleDownloadPageButtonClick } primary>
{ translate( 'Click here to download your copy now!' ) }
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 19 times:
translate( 'Click here to download your copy now.' ) ES Score: 10

@matticbot
Copy link
Contributor

Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D54155-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing the Editing Toolkit Plugin for more info: PCYsg-ly5-p2

@aneeshd16
Copy link
Contributor Author

aneeshd16 commented Dec 11, 2020

Rebased and forgot to push, fixing this branch 🤯
Edit: Fixed.

@aneeshd16 aneeshd16 force-pushed the add/ultimate-traffic-guide branch from e639c97 to 0a8524b Compare December 11, 2020 07:16
</ul>
<p>
{ translate(
'You’re going to want to print out all 96 pages of the Ultimate Traffic Guide and keep it by your desk, because you’re going to consult this guide often.'
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 19 times:
translate( 'Print it out and keep it by your desk, because you’re going to consult this guide often.' ) ES Score: 6

@aneeshd16 aneeshd16 marked this pull request as ready for review December 17, 2020 11:37
@aneeshd16 aneeshd16 requested a review from a team as a code owner December 17, 2020 11:37
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 17, 2020
Comment on lines 35 to 39
export const WPCOM_TRAFFIC_GUIDE = 'traffic-guide';

export const hasTrafficGuidePurchase = ( purchases ) =>
!! (
purchases && purchases.find( ( purchase ) => WPCOM_TRAFFIC_GUIDE === purchase.productSlug )
);

export const downloadTrafficGuide = () => {
window.location.href = 'https://public-api.wordpress.com/wpcom/v2/traffic-guide-download';
};
Copy link
Contributor Author

@aneeshd16 aneeshd16 Dec 17, 2020

Choose a reason for hiding this comment

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

Not sure if this is the best place for these exported consts.

Copy link
Member

Choose a reason for hiding this comment

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

The main problem is with the WPCOM_TRAFFIC_GUIDE constant - it looks like Calypso doesn't have a centralized place or a unified standard for naming such constants. For example, the plans slugs are in lib/plans/constants.js and transfers are in lib/domains/constants. Jetpack products are in lib/products-values/constants.js

Should you create lib/ebooks/constants for this specific constant? Not sure. Maybe. An alternative would be to simply hardcode the product slug instead of use a constant, like the Concierge Session does.

If it was me, I'd probably use the constant and put it where the Jetpack constants are. Looks like Jetpack folks tried to create a unified place but stopped after adding their constants and nobody else picked it up.

@aneeshd16 aneeshd16 changed the title WIP: Adds route & sales page for Ultimate Traffic Guide Adds route & sales page for Ultimate Traffic Guide Dec 17, 2020
@@ -721,4 +721,21 @@ describe( 'getThankYouPageUrl', () => {
} );
expect( url ).toBe( '/checkout/thank-you/foo.bar/1234abcd' );
} );

it( 'redirects to thank you page (with traffic guide display mode) if traffic guide is in cart', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for adding a test! ❤️

Copy link
Member

@dzver dzver left a comment

Choose a reason for hiding this comment

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

It works well for me. Left a few notes.

client/my-sites/marketing/ultimate-traffic-guide/index.js Outdated Show resolved Hide resolved
Comment on lines 35 to 39
export const WPCOM_TRAFFIC_GUIDE = 'traffic-guide';

export const hasTrafficGuidePurchase = ( purchases ) =>
!! (
purchases && purchases.find( ( purchase ) => WPCOM_TRAFFIC_GUIDE === purchase.productSlug )
);

export const downloadTrafficGuide = () => {
window.location.href = 'https://public-api.wordpress.com/wpcom/v2/traffic-guide-download';
};
Copy link
Member

Choose a reason for hiding this comment

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

The main problem is with the WPCOM_TRAFFIC_GUIDE constant - it looks like Calypso doesn't have a centralized place or a unified standard for naming such constants. For example, the plans slugs are in lib/plans/constants.js and transfers are in lib/domains/constants. Jetpack products are in lib/products-values/constants.js

Should you create lib/ebooks/constants for this specific constant? Not sure. Maybe. An alternative would be to simply hardcode the product slug instead of use a constant, like the Concierge Session does.

If it was me, I'd probably use the constant and put it where the Jetpack constants are. Looks like Jetpack folks tried to create a unified place but stopped after adding their constants and nobody else picked it up.

</h2>
<p>
{ translate(
'We developed this 96 page guide to teach you every modern website traffic trick you need to know in 2020 and beyond.'
Copy link
Member

Choose a reason for hiding this comment

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

It will soon become 2021. Do you think we should make the year dynamic?

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 catch! Made this dynamic.

Copy link
Member

@dzver dzver left a comment

Choose a reason for hiding this comment

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

I think it's good to go but it can't be merged just yet, we need the tax code diffs to be merged first.

@aneeshd16 aneeshd16 force-pushed the add/ultimate-traffic-guide branch from 6a84407 to 0039609 Compare December 21, 2020 08:37
const defaultVariation = () => (
<>
<h1 className="ultimate-traffic-guide__header">
{ translate( 'Introducing the WordPress.com Ultimate Traffic Guide' ) }
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 1 times:
translate( 'Introducing The Ultimate Traffic Guide' ) ES Score: 8

) }
</h1>
<h2 className="ultimate-traffic-guide__sub-header">
{ translate( 'Claim your copy of the Ultimate Traffic Guide today' ) }
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 1 times:
translate( 'Claim your copy of the <br /><em>Ultimate Traffic Guide</em>' ) ES Score: 7

Copy link
Member

@dzver dzver left a comment

Choose a reason for hiding this comment

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

LGTM

Depends on D54575-code to be reviewed and launched before merging or may cause Payments Admin issues

@aneeshd16 aneeshd16 merged commit f355bdc into trunk Dec 21, 2020
@aneeshd16 aneeshd16 deleted the add/ultimate-traffic-guide branch December 21, 2020 14:02
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 21, 2020
sarayourfriend pushed a commit that referenced this pull request Dec 23, 2020
* Adds sales and download page for Traffic Guide

* Adds thank you page

* Fixed placeholder class name

* Adds test for checkout thank you page

* Adds alt copy for AB test

* Show the marketing card only for English locales

* Updates logo and copy of card

* Adds alternate copy for experiment

* Adds download link to checkout thank you page

* Fixes incorrect import of the Experiment component

* Moves traffic guide traffic constant to lib

* Makes the year dynamic

* Adds reference cost calculation

* Use native Date instead of moment

* Removes logic from old getCheckoutCompleteRedirectPath
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.

5 participants