Quantcast Download button still doesnt work... - WoWInterface
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,567
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
08-11-14, 11:39 AM   #2
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,191
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,174
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,567
@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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
  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,567
Download button still does not work if Google Analytics is not loaded.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
  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