FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #19515 from guardian/drive-aud-traffic-to-support · devhttps/frontend@91c05ce · GitHub

Commit 91c05ce

Browse files
authored
Merge pull request guardian#19515 from guardian/drive-aud-traffic-to-support
Drive AUD traffic to support platform
2 parents d0077a1 + 754ea39 commit 91c05ce

6 files changed

Lines changed: 31 additions & 185 deletions

File tree

‎static/src/javascripts/lib/geolocation.js‎

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ const countryGroups: CountryGroups = {
367367
},
368368
};
369369

370-
// These are the different 'regions' we accept when taking payment.
370+
// These are the different 'country groups' we accept when taking payment.
371371
// See https://github.com/guardian/support-internationalisation/blob/master/src/main/scala/com/gu/i18n/CountryGroup.scala for more context.
372372
const getSupporterCountryGroup = (location: string): CountryGroupId => {
373373
const availableCountryGroups = Object.keys(countryGroups);
@@ -380,53 +380,25 @@ const getSupporterCountryGroup = (location: string): CountryGroupId => {
380380
return response || 'GBPCountries';
381381
};
382382

383-
const isInEurope = (): boolean => {
384-
const countryCode = getSync();
385-
return (
386-
countryGroups.EURCountries.countries.includes(countryCode) ||
387-
countryCode === 'GB'
388-
);
389-
};
390-
391-
const getLocalCurrencySymbol = (): string =>
392-
({
393-
GBPCountries: '£',
394-
UnitedStates: '$',
395-
AUDCountries: '$',
396-
Canada: 'CA$',
397-
EURCountries: '€',
398-
NZDCountries: 'NZ$',
399-
International: '$',
400-
}[getSupporterCountryGroup(getSync())] || '£');
401-
402383
const extendedCurrencySymbol = {
403384
GBPCountries: '£',
404385
UnitedStates: '$',
405-
EURCountries: '',
386+
AUDCountries: '$',
406387
Canada: 'CA$',
388+
EURCountries: '€',
407389
NZDCountries: 'NZ$',
408-
AUDCountries: '$',
409390
International: '$',
410391
};
411392

412-
const currencySymbol = {
413-
GBPCountries: '£',
414-
UnitedStates: '$',
415-
AUDCountries: '$',
416-
EURCountries: '€',
417-
NZDCountries: '$',
418-
International: '$',
419-
Canada: '$',
420-
};
393+
const getLocalCurrencySymbol = (): string =>
394+
extendedCurrencySymbol[getSupporterCountryGroup(getSync())] || '£';
421395

422396
export {
423397
get,
424398
getSupporterCountryGroup,
425399
getSync,
426400
getLocalCurrencySymbol,
427-
isInEurope,
428401
init,
429402
setGeolocation,
430-
currencySymbol,
431403
extendedCurrencySymbol,
432404
};

‎static/src/javascripts/projects/common/modules/commercial/acquisitions-copy.js‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22
import { getLocalCurrencySymbol } from 'lib/geolocation';
3-
import { useSupportDomain } from 'common/modules/commercial/support-utilities';
3+
44
// control
55
const controlHeading = 'Since you’re here …';
66
const controlP1 =
@@ -26,22 +26,12 @@ const ctaLinkSentence = (
2626
supportUrl: string,
2727
contributionUrl: string,
2828
currencySymbol: string
29-
): string => {
30-
if (useSupportDomain()) {
31-
return `<span class="contributions__highlight"> For as little as ${
32-
currencySymbol
33-
}1, you can support the Guardian – and it only takes a minute.</span> <a href="${
34-
supportUrl
35-
}" target="_blank" class="u-underline">Make a contribution</a>`;
36-
}
37-
return `<span class="contributions__highlight"> For as little as ${
29+
): string =>
30+
`<span class="contributions__highlight"> For as little as ${
3831
currencySymbol
3932
}1, you can support the Guardian – and it only takes a minute.</span> <a href="${
4033
supportUrl
41-
}" target="_blank" class="u-underline">Become a monthly supporter</a> or <a href="${
42-
contributionUrl
43-
}" target="_blank" class="u-underline">make a one-off contribution</a>`;
44-
};
34+
}" target="_blank" class="u-underline">Make a contribution</a>`;
4535

4636
const cambridgeP1 =
4737
'&hellip; now is the time to support investigative reporting. The Guardian and Observer have spent a year analysing documents, working with whistleblowers and gathering eyewitness reports to untangle a complex story around data in the digital age. This took months of painstaking research by a small team of reporters and editors &ndash; and has led to investigations on both sides of the Atlantic. <span class="contributions__highlight">We have received legal threats, including from Facebook, but we are determined to continue publishing stories that raise important questions about the use of people’s data in political campaigns</span> &ndash; from the US election to Brexit.';

‎static/src/javascripts/projects/common/modules/commercial/contributions-utilities.js‎

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,14 @@ import { epicButtonsTemplate } from 'common/modules/commercial/templates/acquisi
2424
import { acquisitionsEpicControlTemplate } from 'common/modules/commercial/templates/acquisitions-epic-control';
2525
import { acquisitionsTestimonialBlockTemplate } from 'common/modules/commercial/templates/acquisitions-epic-testimonial-block';
2626
import { shouldSeeReaderRevenue as userShouldSeeReaderRevenue } from 'common/modules/commercial/user-features';
27-
import {
28-
useSupportDomain,
29-
supportBaseURL,
30-
} from 'common/modules/commercial/support-utilities';
27+
import { supportContributeURL } from 'common/modules/commercial/support-utilities';
3128

3229
type EpicTemplate = (Variant, AcquisitionsEpicTemplateCopy) => string;
3330

3431
export type CtaUrls = {
35-
contributeUrl?: string,
36-
supportUrl?: string,
32+
supportUrl: string,
3733
};
3834

39-
const contributionsBaseURL = 'https://contribute.theguardian.com';
40-
4135
// How many times the user can see the Epic,
4236
// e.g. 6 times within 7 days with minimum of 1 day in between views.
4337
const defaultMaxViews: {
@@ -50,16 +44,14 @@ const defaultMaxViews: {
5044
minDaysBetweenViews: 0,
5145
};
5246

53-
const defaultButtonTemplate = (urls: CtaUrls) =>
54-
epicButtonsTemplate(urls, useSupportDomain());
47+
const defaultButtonTemplate = (url: CtaUrls) => epicButtonsTemplate(url);
5548

5649
const controlTemplate: EpicTemplate = ({ options = {} }, copy) =>
5750
acquisitionsEpicControlTemplate({
5851
copy,
5952
componentName: options.componentName,
6053
testimonialBlock: options.testimonialBlock,
6154
buttonTemplate: options.buttonTemplate({
62-
contributeUrl: options.contributeURL,
6355
supportUrl: options.supportURL,
6456
}),
6557
});
@@ -186,18 +178,8 @@ const makeABTestVariant = (
186178
id,
187179
parentTest.campaignSuffix
188180
),
189-
contributeURL = addTrackingCodesToUrl({
190-
base: contributionsBaseURL,
191-
componentType: parentTest.componentType,
192-
componentId: campaignCode,
193-
campaignCode,
194-
abTest: {
195-
name: parentTest.id,
196-
variant: id,
197-
},
198-
}),
199181
supportURL = addTrackingCodesToUrl({
200-
base: `${options.supportBaseURL || supportBaseURL}`,
182+
base: `${options.supportBaseURL || supportContributeURL}`,
201183
componentType: parentTest.componentType,
202184
componentId: campaignCode,
203185
campaignCode,
@@ -272,7 +254,6 @@ const makeABTestVariant = (
272254
isUnlimited,
273255
products,
274256
campaignCode,
275-
contributeURL,
276257
supportURL,
277258
template,
278259
buttonTemplate,

‎static/src/javascripts/projects/common/modules/commercial/membership-engagement-banner-parameters.js‎

Lines changed: 13 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import {
44
getSupporterCountryGroup,
55
extendedCurrencySymbol,
66
} from 'lib/geolocation';
7-
import type { CountryGroupId } from 'lib/geolocation';
8-
import { supportBaseURL } from './support-utilities';
7+
import { supportContributeURL } from './support-utilities';
98

109
const baseParams = {
1110
minArticles: 3,
@@ -21,40 +20,16 @@ const engagementBannerCopy = (): string =>
2120
produce. But the revenue we get from advertising is falling, so we increasingly need our readers to fund us. If
2221
everyone who reads our reporting, who likes it, helps fund it, our future would be much more secure.`;
2322

24-
// Prices taken from https://membership.theguardian.com/<region>/supporter
23+
const initialContribution = 1;
2524

26-
const paymentAmounts = {
27-
MONTHLY: {
28-
GBPCountries: '5',
29-
UnitedStates: '6.99',
30-
AUDCountries: '10',
31-
Canada: '6.99',
32-
International: '6.99',
33-
NZDCountries: '10',
34-
EURCountries: '4.99',
35-
},
36-
'ONE-OFF': {
37-
GBPCountries: '1',
38-
UnitedStates: '1',
39-
AUDCountries: '1',
40-
Canada: '1',
41-
International: '1',
42-
NZDCountries: '1',
43-
EURCountries: '1',
44-
},
45-
};
25+
const supporterCost = (location: string): string => {
26+
const countryGroup = getSupporterCountryGroup(location);
4627

47-
const supporterCost = (
48-
location: string,
49-
contributionType: 'MONTHLY' | 'ONE-OFF'
50-
): string => {
51-
const region = getSupporterCountryGroup(location);
52-
53-
if (region === 'EURCountries') {
28+
if (countryGroup === 'EURCountries') {
5429
// Format either 4.99 € or €4.99 depending on country
5530
// See https://en.wikipedia.org/wiki/Linguistic_issues_concerning_the_euro
5631
const euro = extendedCurrencySymbol.EURCountries;
57-
const amount = paymentAmounts[contributionType].EURCountries;
32+
const amount = initialContribution;
5833

5934
const euroAfterCountryCodes = [
6035
'BG',
@@ -84,53 +59,21 @@ const supporterCost = (
8459
: euro + amount;
8560
}
8661

87-
return `${extendedCurrencySymbol[region]}
88-
${paymentAmounts[contributionType][region]}`;
62+
return `${extendedCurrencySymbol[countryGroup]}
63+
${initialContribution}`;
8964
};
9065

91-
const supporterEngagementCtaCopy = (location: string): string =>
92-
`Support us for ${supporterCost(location, 'MONTHLY')} a month.`;
93-
9466
const supporterEngagementCtaCopyJustOne = (location: string): string =>
95-
`Support The Guardian from as little as ${supporterCost(
96-
location,
97-
'ONE-OFF'
98-
)}.`;
67+
`Support The Guardian from as little as ${supporterCost(location)}.`;
9968

100-
const supporterParams = (location: string): EngagementBannerParams =>
69+
export const engagementBannerParams = (
70+
location: string
71+
): EngagementBannerParams =>
10172
Object.assign({}, baseParams, {
10273
buttonCaption: 'Support The Guardian',
103-
linkUrl: supportBaseURL,
74+
linkUrl: supportContributeURL,
10475
products: ['CONTRIBUTION', 'RECURRING_CONTRIBUTION'],
10576
messageText: engagementBannerCopy(),
10677
ctaText: supporterEngagementCtaCopyJustOne(location),
10778
pageviewId: config.get('ophan.pageViewId', 'not_found'),
10879
});
109-
110-
const membershipSupporterParams = (location: string): EngagementBannerParams =>
111-
Object.assign({}, baseParams, {
112-
buttonCaption: 'Become a Supporter',
113-
linkUrl: 'https://membership.theguardian.com/supporter',
114-
products: ['MEMBERSHIP_SUPPORTER'],
115-
messageText: engagementBannerCopy(),
116-
ctaText: supporterEngagementCtaCopy(location),
117-
pageviewId: config.get('ophan.pageViewId', 'not_found'),
118-
});
119-
120-
export const engagementBannerParams = (
121-
location: string
122-
): EngagementBannerParams => {
123-
const region = getSupporterCountryGroup(location);
124-
const supportRegions: CountryGroupId[] = [
125-
'UnitedStates',
126-
'GBPCountries',
127-
'EURCountries',
128-
'International',
129-
'NZDCountries',
130-
'Canada',
131-
];
132-
if (supportRegions.includes(region)) {
133-
return supporterParams(location);
134-
}
135-
return membershipSupporterParams(location);
136-
};
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
// @flow
2-
import {
3-
getSync as geolocationGetSync,
4-
getSupporterCountryGroup as geolocationGetSupporterPaymentRegion,
5-
} from 'lib/geolocation';
2+
const supportContributeURL = 'https://support.theguardian.com/contribute';
3+
const supportSubscribeURL = 'https://support.theguardian.com/subscribe';
64

7-
const geo: string = geolocationGetSync();
8-
const geoCountryGroup = geolocationGetSupporterPaymentRegion(geo);
9-
10-
const useSupportDomain = (): boolean =>
11-
geoCountryGroup === 'GBPCountries' ||
12-
geoCountryGroup === 'UnitedStates' ||
13-
geoCountryGroup === 'EURCountries' ||
14-
geoCountryGroup === 'International' ||
15-
geoCountryGroup === 'NZDCountries' ||
16-
geoCountryGroup === 'Canada';
17-
18-
const supportBaseURL = useSupportDomain()
19-
? 'https://support.theguardian.com/contribute'
20-
: 'https://membership.theguardian.com/supporter';
21-
22-
export { useSupportDomain, supportBaseURL };
5+
export { supportContributeURL, supportSubscribeURL };

‎static/src/javascripts/projects/common/modules/commercial/templates/acquisitions-epic-buttons.js‎

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,7 @@
22
import type { CtaUrls } from 'common/modules/commercial/contributions-utilities';
33
import config from 'lib/config';
44

5-
export const epicButtonsTemplate = (
6-
{ supportUrl = '', contributeUrl = '' }: CtaUrls,
7-
useSupportDomain: boolean = false
8-
) => {
9-
const contribButton = `
10-
<div>
11-
<a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member"
12-
href="${contributeUrl}"
13-
target="_blank">
14-
Make a contribution
15-
</a>
16-
</div>`;
17-
const supportButtonBecome = `
18-
<div>
19-
<a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member"
20-
href="${supportUrl}"
21-
target="_blank">
22-
Become a supporter
23-
</a>
24-
</div>`;
5+
export const epicButtonsTemplate = ({ supportUrl = '' }: CtaUrls) => {
256
const supportButtonSupport = `
267
<div>
278
<a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member contributions__contribute--epic-single-button"
@@ -38,11 +19,7 @@ export const epicButtonsTemplate = (
3819

3920
return `
4021
<div class="contributions__amount-field">
41-
${
42-
useSupportDomain
43-
? supportButtonSupport
44-
: supportButtonBecome + contribButton
45-
}
22+
${supportButtonSupport}
4623
${paymentLogos}
4724
</div>`;
4825
};

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL