Thread Tools Display Modes
08-11-14, 11:19 AM   #1
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-11-14, 11:39 AM   #2
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,339
Thanks Phanx, I'll try that.
  Reply With Quote
08-11-14, 11:55 AM   #3
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
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>
  Reply With Quote
08-11-14, 01:21 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
@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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-22-14, 04:06 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Download button still does not work if Google Analytics is not loaded.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Site Forums » Minion » Download button still doesnt work...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off