WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Minion (https://www.wowinterface.com/forums/forumdisplay.php?f=124)
-   -   Download button still doesnt work... (https://www.wowinterface.com/forums/showthread.php?t=49624)

Phanx 08-11-14 11:19 AM

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.

Dolby 08-11-14 11:39 AM

Thanks Phanx, I'll try that. :)

ravagernl 08-11-14 11:55 AM

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>

Phanx 08-11-14 01:21 PM

@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.

Phanx 09-22-14 04:06 PM

Download button still does not work if Google Analytics is not loaded.


All times are GMT -6. The time now is 02:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI