@@ -8,8 +8,8 @@ if (typeof Mozilla === 'undefined') {
88
99 /**
1010 * Super simple ABTest module, it puts you in one of the buckets.
11- * Bucket === 0 - FundraiseUp
12- * Bucket === 1 - give.thunderbird.net
11+ * Bucket === 0 - A
12+ * Bucket === 1 - B
1313 */
1414 const ABTest = { } ;
1515 ABTest . bucket = null ;
@@ -23,18 +23,21 @@ if (typeof Mozilla === 'undefined') {
2323 * Once a bucket has been chosen, this function does nothing.
2424 */
2525 ABTest . Choose = function ( ) {
26+ /*
2627 if (ABTest.bucket !== null) {
2728 return;
2829 }
2930
3031 ABTest.bucket = ABTest.RandomInt(0, 1);
32+ */
3133 }
3234
3335 /**
3436 * Tracks our bucket choice.
3537 * Called from matomo.js, registers a bucket if no bucket has been chosen.
3638 */
3739 ABTest . Track = function ( ) {
40+ /*
3841 if (ABTest.bucket === null) {
3942 ABTest.Choose();
4043 }
@@ -43,75 +46,33 @@ if (typeof Mozilla === 'undefined') {
4346 const _paq = window._paq = window._paq || [];
4447
4548 // TrackEvent: Category, Action, Name
46- _paq . push ( [ 'trackEvent' , 'AB-Test - Donation Flow 2023' , 'Bucket Registration' , ABTest . bucket === 0 ? 'fru' : 'give' ] ) ;
49+ _paq.push(['trackEvent', 'AB-Test - Test Name Here', 'Bucket Registration', ABTest.bucket === 0 ? 'a' : 'b']);
50+ */
4751 }
4852
4953 /**
5054 * Are we in the FundraiseUp bucket?
5155 * @returns {boolean }
5256 */
53- ABTest . IsInFundraiseUpBucket = function ( ) {
57+ ABTest . IsInBucketA = function ( ) {
5458 return ABTest . bucket === 0 ;
5559 }
5660
5761 /**
5862 * Are we in the legacy give.thunderbird.net bucket?
5963 * @returns {boolean }
6064 */
61- ABTest . IsInGiveBucket = function ( ) {
65+ ABTest . IsInBucketB = function ( ) {
6266 return ABTest . bucket === 1 ;
6367 }
6468
65- /**
66- * FundraiseUp's download functionality. This will simply raise the Donation form.
67- * @param download_url
68- * @private
69- * @deprecated Might be removed in a later release
70- */
71- ABTest . _FundraiseUpDownload = function ( download_url ) {
72- window . Mozilla . Donation . DisplayDownloadForm ( download_url ) ;
73- }
74-
75- /**
76- * Legacy give.thunderbird.net download functionality.
77- * This will redirect them to the donation url, which will start the download.
78- * @param download_url
79- * @param donate_url
80- * @private
81- */
82- ABTest . _GiveDownload = function ( download_url , donate_url ) {
83- // Don't redirect if we're on the failed download page.
84- if ( $ ( "body" ) . attr ( 'id' ) !== 'thunderbird-download' ) {
85- // MSIE and Edge cancel the download prompt on redirect, so just leave them out.
86- if ( ! ( / m s i e \s | t r i d e n t \/ | e d g e \/ / i. test ( navigator . userAgent ) ) ) {
87- setTimeout ( function ( ) {
88- window . location . href = donate_url ;
89- } , 5000 ) ;
90- }
91- }
92- window . Mozilla . Utils . triggerIEDownload ( download_url ) ;
93- }
94-
95- /**
96- * Start the Download, it will handle determining what bucket we're in and what download path we need to go down.
97- * @param event : Event
98- */
99- ABTest . Download = function ( event ) {
100- const element = event . target ;
101- const download_url = element . href ;
102- const donate_url = element . dataset . donateLink || null ;
103-
104- if ( ABTest . IsInGiveBucket ( ) ) {
105- ABTest . _GiveDownload ( download_url , donate_url ) ;
106- }
107- }
108-
10969 /**
11070 * Replaces a 'HTMLAnchorElement' href tag with the bucket's (only FRU right now) equivalent url.
11171 * @param element : HTMLAnchorElement
11272 */
11373 ABTest . ReplaceDonateLinks = function ( element ) {
114- if ( ABTest . IsInFundraiseUpBucket ( ) ) {
74+ /*
75+ if (ABTest.IsInBucketA()) {
11576 // If we somehow don't have an element, we can exit and still start any redirects.
11677 if (!element) {
11778 return;
@@ -126,6 +87,7 @@ if (typeof Mozilla === 'undefined') {
12687
12788 element.href = window.Mozilla.Donation.MakeDonateUrl(utmContent, utmSource, utmMedium, utmCampaign, redirect);
12889 }
90+ */
12991 }
13092
13193 /**
@@ -135,27 +97,6 @@ if (typeof Mozilla === 'undefined') {
13597 ABTest . Init = function ( ) {
13698 // Pick one!
13799 ABTest . Choose ( ) ;
138-
139- // Replace the donation button's links with the correct one.
140- const donate_buttons = document . querySelectorAll ( '[data-donate-btn]' ) ;
141- for ( const donate_button of donate_buttons ) {
142- ABTest . ReplaceDonateLinks ( donate_button ) ;
143- }
144-
145- // Replace the download button's links with our download redirect
146- // But only do that if we're not already on the download page
147- if ( window . location . href . indexOf ( '/download/' ) === - 1 ) {
148- const download_buttons = document . querySelectorAll ( '.download-link' ) ;
149- for ( const download_button of download_buttons ) {
150- ABTest . ReplaceDonateLinks ( download_button ) ;
151-
152- // If we're in FRU bucket, don't trigger download events for our non-download page buttons
153- // Otherwise we'll be getting download==thunderbird.net instead of download==download.mozilla.org
154- if ( ABTest . IsInFundraiseUpBucket ( ) ) {
155- download_button . className = download_button . className . replace ( 'matomo-track-download' , '' ) ;
156- }
157- }
158- }
159100 }
160101
161102 window . Mozilla . ABTest = ABTest ;
0 commit comments