On our wiki (1.34 and is public), I'm trying to load an external library of JavaScript and then record a pageview for web analytics. So I wrote a simple extension.
The extension I created AdobeLaunch
But, the javascript code is not loaded at all.
I tried a pure JavaScript implementation (e.g. MediaWiki:Common.js) too without success.
/* Adobe Launch added 2020-11-09 */
(function(a,b,c,d){
a='//assets.adobedtm.com/05064fe6cab0/c247cd0acad1/launch-7e623b6eec86.min.js';
b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;
a=b.getElementsByTagName(c)[0];a.parentNode.insertBefore(d,a);
})();
$( document ).ready(function() {
console.log( "ready! Recording Page View\n" );
window._satellite.track('page_view',{
'site_id': 'FamilySearch',
'site_language': mw.config.get('wgContentLanguage'), // 'en'
'page_channel': 'Wiki',
'page_detail': document.location.pathname //'Home' for the homepage or a unique page title for other pages
});
});
I also tried a Gadgets implementation but it wouldn’t work. (Activate it here)
function init() { /* Code that depends on document-ready, external script, and some modules. */ console.log( "ready! Recording Page View\n" ); window._satellite.track('page_view',{
Help?
~ Greg
eQuality Technology
Let's work together
https://equality-tech.com
follow us: https://twitter.com/eQualityTech
creators of https://QualityBox.us