Download button still doesnt work...
... when Google Analytics isn't loaded.
<div class="dwnldBtn"><a onclick="ga('send', 'event', 'Downloads', 'Minion-Win', { 'hitCallback': function() { document.location = 'http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe'; }}); return false;" href="http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe"></a></div>That "return false" is the problem. If GA really requires hardcoded onclick handlers, you can at least wrap it in a check so it doesn't break the link when GA isn't available: <div class="dwnldBtn"><a onclick="if(window.gaGlobal){ga('send', 'event', 'Downloads', 'Minion-Win', { 'hitCallback': function() { document.location = 'http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe'; }}); return false;}" href="http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe"></a></div>This currently affects the download button itself, and the links right below it for downloading for other operating systems. |
Thanks Phanx, I'll try that. :)
|
Alternative, using error catching:
<div class="dwnldBtn"><a onclick="try{ga('send', 'event', 'Downloads', 'Minion-Win', { 'hitCallback': function() { document.location = 'http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe'; }}); return false;}catch(e){}" href="http://cdn.mmoui.com/minion/Minion2.0.11b-beta.exe"></a></div> |
@ravagernl:
That won't work, because the inline JavaScript on the page defines a default "ga" function if the real script fails to load, to avoid throwing errors. The current onclick handler is valid scripting and will run without error, it just won't result in the link actually being followed, because the fallback "ga" function doesn't execute the "hitCallback" function, or do anything else with any of the values passed to it. |
Download button still does not work if Google Analytics is not loaded.
|
All times are GMT -6. The time now is 03:45 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI