MediaWiki:Common.js: Difference between revisions

From FamilySearch Wiki
No edit summary
No edit summary
Line 8: Line 8:
     // Now configure the page data and manually trigger the page view
     // Now configure the page data and manually trigger the page view
     FS.Analytics.updatePageViewData({
     FS.Analytics.updatePageViewData({
      site_id: 'FamilySearch',
  site_language: mw.config.get('wgContentLanguage'), // e.g. 'en'
  page_channel: 'Wiki',
  page_channel: 'Wiki',
  page_detail: document.location.pathname + document.location.search, //'Home' for the homepage or a unique page title for other pages; including querystring
  page_detail: 'Wiki Test'
  page_type: 'wiki',
  visitor_state: 'lo'
     });
     });
     FS.Analytics.trackPageView();
     FS.Analytics.trackPageView();

Revision as of 12:04, 17 November 2022

/* Add Adobe Analytics Tracking Details 2022-11-17 */
// First listen to an event that is fired when the FS object is available
window.addEventListener('ExReady', function(){
  
  // Call setTimeout to avoid a flaw in FS that triggers infinite recursion
  setTimeout(function(){

    // Now configure the page data and manually trigger the page view
    FS.Analytics.updatePageViewData({
	  page_channel: 'Wiki',
	  page_detail: 'Wiki Test'
    });
    FS.Analytics.trackPageView();
  });
});
/* End Adobe Analytics Tracking Details */