Page MenuHomePhabricator

Look into the popup when the WMF banner is closed
Open, Needs TriagePublic5 Estimated Story Points

Description

The WMF are doing something cool with the banners on Vector:

  • When a donor closes it a popup shows over the donate button to tell them where they can donate in the future.
  • If possible we should track an event when the donor clicks

GIF:

2026-09-03 14.43.05.gif (1,350×755 px, 675 KB)

Picture of the new feature:
Bildschirmfoto vom 2026-09-10 10-58-59.png (440×197 px, 46 KB)

Banner: https://meta.wikimedia.org/wiki/Special:CentralNoticeBanners/edit/B2425_0131_mlWW_dsk_p1_lg_template

The code that shows the popup is:

frb.showDonateLinkTooltip = function ( content ) {
	let TIME_TO_SHOW = 5000; // 5 seconds
	try {
		mw.loader.using( [ 'oojs-ui-core' ] ).done( function () {

			let $donateLink = $( '#pt-sitesupport-2 a, #pt-sitesupport a, #n-sitesupport a, #p-donation a, .navigation-drawer .donate-banner a' );
			$donateLink.attr( 'href', ( i, oldUrl ) => {
				let url = new URL( oldUrl, 'https://donate.wikimedia.org' ); // base needed because some links are protocol relative
				url.searchParams.delete( 'utm_source' ); // Until we have updated sidebar links
				url.searchParams.set( 'wmf_source', 'tooltipOnBannerClose' );
				return url.toString();
			});

			let popupOptions = {
				$content: $( '<p>' + content + '</p>' ),
				padded: true,
				autoClose: true,
				align: 'forwards',
				autoFlip: false
			};

			if ( document.querySelector( '#p-donation a, .navigation-drawer .donate-banner a' ) ) {
				// Minerva
				popupOptions.$floatableContainer = $( '.navigation-drawer' );
				popupOptions.position = 'below';
			} else if ( $( '#pt-sitesupport-2 a:visible' ).length > 0 ) {
				// Vector 2022 user tools
				popupOptions.$floatableContainer = $( '#pt-sitesupport-2 a' );
				popupOptions.position = 'below';
			} else if ( document.querySelector( '#pt-sitesupport a' ) ) {
				// Vector 2022 user tools collapsed in menu
				popupOptions.$floatableContainer = $( '#vector-user-links-dropdown' );
				popupOptions.position = 'below';
			} else if ( document.querySelector( '#vector-main-menu-dropdown #n-sitesupport a') ) {
				// Vector 2022 main menu (only when logged in, so mostly here for testing)
				popupOptions.$floatableContainer = $( '#vector-main-menu-dropdown' );
				popupOptions.position = 'below';
			} else if ( document.querySelector( '#n-sitesupport a' ) ) {
				// Legacy Vector (sidebar)
				popupOptions.$floatableContainer = $( '#n-sitesupport a' );
				popupOptions.position = 'after';
			} else {
				console.log('No donate link element found for tooltip');
				return;
			}

			let popup = new OO.ui.PopupWidget( popupOptions );

			popup.$element.css('z-index', 5); // Fix so it shows above header
			$( document.body ).append( popup.$element );
			popup.toggle( true );

			setTimeout( () => {
				popup.$element.fadeOut( frb.fadeDuration );
			}, TIME_TO_SHOW );
		} );
	} catch (e) {
		console.log('Problem showing banner close tooltip');
	}
};

Event Timeline

AbbanWMDE updated the task description. (Show Details)

question: how does this work out with the new soft-close test?

MelWMDE set the point value for this task to 5.Sep 9 2026, 10:51 AM

assigning Lucas because it's a good ticket for him

Oops, I forgot to add this to the sprint when I started working on it 🤦️

PR 2^10! https://github.com/wmde/fundraising-banners/pull/1024

Obviously shouldn’t be merged in this state (the task is also “look into”), but I think Review is still the right column for it now?

I think this can go back into review… or perhaps this task, per se, is more or less done, in that we can report back to stakeholders “yes, this is possible, let us know if we should actually implement it for the next round of banners”?

(Paired with at least one question about the behavior that came up during review: if the banner is not shown because the user clicked the search field, one of the edit buttons, or the language selector button, should the popup be shown? And also, what exactly should the German and English copy be?)

Other questions for stakeholders:

  • The WMF banner updates the URL of the donate link to add wmf_source&tooltipOnBannerClose (and drop any existing utm_source). Which changes, if any, should we make to the URL?
  • How long should the popup stay visible? (In the WMF banner it’s five seconds.)

And I think this is more of a dev question:

  • Should we log to the console if we can’t find any donate link to attach the popup to? Or just silently do nothing in that case?
AbbanWMDE updated the task description. (Show Details)

@Lucas_Werkmeister_WMDE in terms of copy. You can use the WMF copy for EN and "Sie können jederzeit über diesen Link spenden." for DE. And that thing should be seen as an enhancement of our banners, so whenever the user does something that would prevent the banner from showing up, the pop up should follow. But since it is immediately after the x - click, I guess it is a rare edge case. Thanks!

looks good to me, one thing would be good though: On mobile it would be good to say "Sie können jederzeit über dieses Menü spenden" because the tool tip points to the hamburger menu. Is that doable?

Okay – should the English text also be split between “link” and “menu” then?

Also, the “if the banner is not shown because the user clicked the search field…” behavior was actually broken. I’ve fixed it now, so you can test that here by clicking into the search field before the banner shows up (but you need to wait for the banner code itself to load first – this might take a few attempts):

Oh, and we still need to know what URL parameter to add to the donate link, if any. In the current code it’s &wmde_source=tooltipOnBannerClose, which is just a random string I pulled out of my backside. (Or should we just not change the donate link at all? AFAICT the URL parameter doesn’t make it through the redirects to spenden.wikimedia.de anyway. But I don’t know what we do with other tracking parameters around this area.)

Done for now (not enabled in any actual banner); can be enabled in future, by adding this to the props when mounting the BannerConductor (make sure to add it to the conductor’s props, not the bannerProps inside):

	showDonateLinkTooltip: true,