Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F30873022
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
awight
Oct 21 2019, 3:09 PM
2019-10-21 15:09:33 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
Not empty banner. <button class="foobutt">Foo</button>
<script lang="javascript">
/**
* Minimal banner code to report banner history information and associate with a click.
* Requires that the containing campaign have "Banner history logging" enabled.
*
* If sampling the banner history logs, use parameter `?bannerHistoryLogRate=1` for debugging.
*/
$( function () {
$( '.foobutt' ).click( function () {
var bannerHistoryLoggingId,
mixins = mw.centralNotice.getDataProperty( 'mixins' ),
trackers = [];
if ( mixins && mixins.bannerHistoryLogger ) {
// Note that the logging ID is not uniquely-identifying for a given user, it is `mw.user.generateRandomSessionId()` and will change between requests.
bannerHistoryLoggingId = mw.centralNotice.bannerHistoryLogger.id;
trackers.push(
// FIXME: this is really annoying, it can be omitted if you're okay with dropping browsers without beaconSend.
mw.centralNotice.bannerHistoryLogger.ensureLogSent()
);
}
Promise.all(trackers).then( function () {
mw.track( 'event.WMDEBannerEvents', {
bannerAction: 'mobile-mini-banner-expanded',
// FIXME: logging ID would be passed in its own field, this was a workaround for EventLogging validation.
bannerName: 'TestBanner, logging ID ' + bannerHistoryLoggingId,
eventRate: 123
} );
} );
} );
} );
</script>
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8142734
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P9413 Minimum banner history logger
Attached
Detach File
Event Timeline
Log In to Comment