Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #3894, implement A/B test for text-free Download button on shot page
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhirsch committed Dec 8, 2017
1 parent 6814bc8 commit f5759b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 10 additions & 0 deletions server/src/ab-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ let allTests = {
{name: "newicon", probability: 0.1}
],
exclude: ["*"]
},
downloadText: {
description: "Test the effect of removing the word 'Download' from the download button on the shot page",
gaField: "cd9",
version: 1,
options: [
{name: "no-download-text", probability: 0.1}
],
exclude: ["*"],
appliesToPublic: true
}
};

Expand Down
12 changes: 8 additions & 4 deletions server/src/pages/shot/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,13 @@ class Body extends React.Component {
favicon = <div style={{backgroundImage: `url("${shot.favicon}")`}} className="favicon" />;
}

const shotPageDownload = <Localized id="shotPageDownload"><span className="download-text">Download</span></Localized>;

const noText = this.props.abTests && this.props.abTests.downloadText
&& this.props.abTests.downloadText.value === "no-download-text";
const downloadText = [<img src={ this.props.staticLink("/static/img/download-white.svg") } width="20" height="20"/>,
'\u00a0',
<Localized id="shotPageDownload"><span className="download-text">Download</span></Localized>];
const downloadNoText = [<img src={ this.props.staticLink("/static/img/download-white.svg") } width="20" height="20"/>,
<span className="download-text"></span>];
return (
<reactruntime.BodyTemplate {...this.props}>
{ renderGetFirefox ? this.renderFirefoxRequired() : null }
Expand All @@ -412,8 +417,7 @@ class Body extends React.Component {
<Localized id="shotPageDownloadShot">
<a className="button primary" href={ this.props.downloadUrl } onClick={ this.onClickDownload.bind(this) }
title="Download the shot image">
<img src={ this.props.staticLink("/static/img/download-white.svg") } width="20" height="20"/>&nbsp;
{shotPageDownload}
{ (noText) ? downloadNoText : downloadText }
</a>
</Localized>
</div>
Expand Down

0 comments on commit f5759b4

Please sign in to comment.