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

Stats: Gate currently open summary pages #97274

Merged
merged 7 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/my-sites/stats/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const STAT_TYPE_CLICKS = 'statsClicks';
export const STAT_TYPE_COMMENT_FOLLOWERS = 'statsCommentFollowers';
export const STAT_TYPE_COMMENTS = 'statsComments';
export const STAT_TYPE_COUNTRY_VIEWS = 'statsCountryViews';
export const STAT_TYPE_FILE_DOWNLOADS = 'statsFileDownloads';
export const STAT_TYPE_FOLLOWERS = 'statsFollowers';
export const STAT_TYPE_INSIGHTS_ALL_TIME_STATS = 'statsInsightsAllTimeStats';
export const STAT_TYPE_INSIGHTS_MOST_POPULAR_TIME = 'statsInsightsMostPopularTime';
Expand Down
13 changes: 13 additions & 0 deletions client/my-sites/stats/hooks/use-should-gate-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
STAT_TYPE_REFERRERS,
STAT_TYPE_COUNTRY_VIEWS,
STAT_TYPE_CLICKS,
STAT_TYPE_FILE_DOWNLOADS,
STAT_TYPE_TOP_AUTHORS,
STAT_TYPE_SEARCH_TERMS,
STAT_TYPE_VIDEO_PLAYS,
Expand Down Expand Up @@ -104,8 +105,11 @@ const gatedStats = [
STATS_TYPE_DEVICE_STATS,

// Paid Stats
STAT_TYPE_TOP_POSTS,
STAT_TYPE_REFERRERS,
STAT_TYPE_COUNTRY_VIEWS,
STAT_TYPE_CLICKS,
STAT_TYPE_FILE_DOWNLOADS,
...defaultDateControlGates,
STATS_FEATURE_DOWNLOAD_CSV,
STATS_FEATURE_INTERVAL_DROPDOWN_WEEK,
Expand Down Expand Up @@ -253,6 +257,15 @@ export const shouldGateStats = ( state: object, siteId: number | null, statType:
return basicStats.includes( statType );
}

// If v3 is not enabled do not directly gate top posts, file downloads, and country views.
// We could remove this check once v3 is enabled.
if (
! isEnabled( 'stats/paid-wpcom-v3' ) &&
[ STAT_TYPE_TOP_POSTS, STAT_TYPE_FILE_DOWNLOADS, STAT_TYPE_COUNTRY_VIEWS ].includes( statType )
) {
return false;
}

// All other sites get gated to 7 days + paywall upsell
return gatedStats.includes( statType );
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import {
STATS_FEATURE_UTM_STATS,
STATS_TYPE_DEVICE_STATS,
STAT_TYPE_CLICKS,
STAT_TYPE_COUNTRY_VIEWS,
a8ck3n marked this conversation as resolved.
Show resolved Hide resolved
STAT_TYPE_FILE_DOWNLOADS,
STAT_TYPE_REFERRERS,
STAT_TYPE_SEARCH_TERMS,
STAT_TYPE_TOP_AUTHORS,
STAT_TYPE_TOP_POSTS,
STAT_TYPE_VIDEO_PLAYS,
} from '../constants';
import StatsCardUpsellOverlay from './stats-card-upsell-overlay';
Expand All @@ -19,22 +22,28 @@ import './style.scss';

const getUpsellCopy = ( statType: string ) => {
switch ( statType ) {
case STAT_TYPE_REFERRERS:
return translate(
'Find out where your visitors come from to optimize your content strategy.'
);
case STAT_TYPE_CLICKS:
return translate(
'Learn what external links your visitors click on your site to reveal their areas of interest.'
);
case STAT_TYPE_COUNTRY_VIEWS:
return translate( 'See where your visitors come from.' );
case STAT_TYPE_FILE_DOWNLOADS:
return translate( 'Monitor your file downloads engagement.' );
case STAT_TYPE_REFERRERS:
return translate(
'Find out where your visitors come from to optimize your content strategy.'
);
case STAT_TYPE_SEARCH_TERMS:
return translate( 'Discover the terms and phrases your visitors use to find your site.' );
case STAT_TYPE_TOP_AUTHORS:
return translate( 'Identify your audience’s favorite writers and perspectives.' );
case STATS_FEATURE_DATE_CONTROL:
return translate( 'Compare different time periods to analyze your site’s growth.' );
case STAT_TYPE_TOP_POSTS:
return translate( 'Track posts and pages views.' );
case STAT_TYPE_VIDEO_PLAYS:
return translate( 'Discover your most popular videos and find out how they performed.' );
case STATS_FEATURE_DATE_CONTROL:
return translate( 'Compare different time periods to analyze your site’s growth.' );
case STATS_FEATURE_UTM_STATS:
return translate( 'Generate UTM parameters and track your campaign performance data.' );
case STATS_TYPE_DEVICE_STATS:
Expand Down
Loading