Google's Event Tracker Issue

Discussion in 'Javascript' started by justaguy, Jul 27, 2011.

  1. justaguy

    justaguy Guest

    My first attempt to try this Google widget it and am having a problem
    with it... yes, I've posted to a relevant Google forum, however, no
    response yet. Thought, maybe some of you have experience with it as
    well...

    Problematic Page:
    http://www.knowledgenotebook.com/download_dev.html

    Issue:
    The following code does not prompt for the software program download
    as it is supposed to.
    <a href="#" onClick="document.href.location='/download/
    KnowledgeNoteBook_g2v4_s.exe';_gaq.push(['_trackEvent','knDownload','exe','',
    1]);"><img src="images/download-now.png" alt="Download Now" /></a>

    And yes, Google Tracking code is the bottom of the html code.

    What am I doing wrong here?

    Thanks.
     
    justaguy, Jul 27, 2011
    #1
    1. Advertisements

  2. justaguy

    justaguy Guest

    I thought I did that per Google Analytics instruction... the
    index.html tracks site traffic just fine... but anyway, I move the
    google script to inside the HEAD element, still to no avail.
    With Chrome 12, click on the [Download] button did nothing.
    With Firefox 3.6x it brought up Google Event data but the Download
    Program (exe file) was prompted for downloading as it is supposed to.
    They've got a bug something?
     
    justaguy, Jul 27, 2011
    #2
    1. Advertisements

  3. justaguy

    RobG Guest

    Why don't you use a real href?

    <a href="/download/KnowledgeNoteBook_g2v4_s.exe'"
    onClick="
    _gaq.push(['_trackEvent','knDownload','exe','',1]);
    "><img src="images/download-now.png" alt="Download Now"></a>

    Now the browser can deal with the MIME type as it sees fit and
    according to user preferences regardless of whether the script runs or
    not.
     
    RobG, Jul 27, 2011
    #3
  4. justaguy

    justaguy Guest

    Just an update, I've solved the problem.

    The following URL works for the Google Event Tracker:
    http://www.knowledgenotebook.com/download.html

    Frankly Google documentation about it is poor...
     
    justaguy, Jul 27, 2011
    #4
  5. justaguy

    dhtml Guest

    WRT the download link:

    | <a href="/download/KnowledgeNoteBook_g2v4_s.exe"
    | onclick="javascript: _gaq.push(['_trackPageview','knDownload']);"
    | ><img src="images/download-now.png" alt="Download Now" /></a>

    Firefox' "Save" dialog appears, so that works.

    Other problems include serving invalid XHTML, serving that as text/
    html, using a rotting old version of jQuery, using a totally useless
    `javascript:` label, using nonstandard, though widely implemented
    `document.location` (use window.location instead). Trivia: when is
    document.location null?

    Server stats should provide more reliable results than client-side
    javascript APIs (such as Google's), and especially for someone who's
    not that strong in javascript.
     
    dhtml, Jul 27, 2011
    #5
  6. justaguy

    justaguy Guest

    "Server stats should provide more reliable results"
    ok, thanks for the thought.

    "using a totally useless
    yeah, found it odd, but that's exactly how Google's "expert" article
    had it...

    [ WRT the download link:
    ]
    And the Download page itself and other related pages would suffice for
    an answer, why ask?
     
    justaguy, Jul 27, 2011
    #6
  7. justaguy

    justaguy Guest

    Rob, I'm not sure if your value for the first argument of
    "_trackEvent" would work. Thought I tried that before...
     
    justaguy, Jul 27, 2011
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.