mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 07:00:25 -04:00
Merge pull request #5434 from LLK/hotfix/donate-banner-analytics
[Master] Hotfix Donate Banner Update
This commit is contained in:
commit
b287c5967f
2 changed files with 18 additions and 5 deletions
|
@ -8,8 +8,23 @@ const Button = require('../../../components/forms/button.jsx');
|
|||
|
||||
require('./donate-banner.scss');
|
||||
|
||||
const donateURL = 'https://secure.donationpay.org/scratchfoundation';
|
||||
|
||||
const navigateToDonatePage = () => {
|
||||
window.location = 'https://secure.donationpay.org/scratchfoundation';
|
||||
window.location = donateURL;
|
||||
};
|
||||
|
||||
// Following the example in the Google Analytics doc here to track
|
||||
// clicks going out to the donate page from this banner:
|
||||
// https://support.google.com/analytics/answer/1136920?hl=en
|
||||
const captureOutboundLinkToDonate = () => {
|
||||
// `ga` is a global we have thanks to src/template.ejs
|
||||
// use this to send a tracking event for this outbound link
|
||||
// eslint-disable-next-line no-undef
|
||||
ga('send', 'event', 'outbound', 'click', donateURL, {
|
||||
transport: 'beacon',
|
||||
hitCallback: navigateToDonatePage
|
||||
});
|
||||
};
|
||||
|
||||
const DonateTopBanner = ({
|
||||
|
@ -28,7 +43,7 @@ const DonateTopBanner = ({
|
|||
<Button
|
||||
className="donate-button"
|
||||
key="add-to-studio-button"
|
||||
onClick={navigateToDonatePage}
|
||||
onClick={captureOutboundLinkToDonate}
|
||||
>
|
||||
<FormattedMessage id="general.donate" />
|
||||
</Button>
|
||||
|
|
|
@ -12,8 +12,7 @@ const splashActions = require('../../redux/splash.js');
|
|||
const Page = require('../../components/page/www/page.jsx');
|
||||
const SplashPresentation = require('./presentation.jsx');
|
||||
|
||||
const SCRATCH_WEEK_START_TIME = 1621224000000; // 2021-05-17 00:00:00
|
||||
const SCRATCH_WEEK_END_TIME = 1621828800000; // 2021-05-24 00:00:00
|
||||
const SCRATCH_WEEK_START_TIME = 1621224000000; // 2021-05-17 00:00:00 -- No end time for now
|
||||
const HOC_START_TIME = 1605484800000; // 2020-11-16 00:00:00
|
||||
const HOC_END_TIME = 1608681600000; // 2020-12-23 00:00:00
|
||||
|
||||
|
@ -178,7 +177,6 @@ class Splash extends React.Component {
|
|||
this.props.sessionStatus === sessionActions.Status.FETCHED && // done fetching session
|
||||
Object.keys(this.props.user).length === 0 && // no user session found
|
||||
Date.now() >= SCRATCH_WEEK_START_TIME &&
|
||||
Date.now() < SCRATCH_WEEK_END_TIME &&
|
||||
this.shouldShowHOCTopBanner() !== true
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue