Link to home
Start Free TrialLog in
Avatar of azimuth28
azimuth28

asked on

Event tracking - Google Analytics

Hi,
I want to track the clicks on outbound links in Google Analytics and i've setup an event tracking (see below).
The reports should show me the clicks on the links included in the div with the id="mydiv", that's why i've setup that function to append the event to all the hrefs in that div.
The thing is i cannot see any data in the Event tracking in Analytics reports. I must be doing something wrong?!
Please help
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-xx']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


<script type = "text/javascript">
    // Define the entry point
    $(document).ready(function()
    {
        $('a','#mydiv').click(function() {
          _gaq.push(['_trackEvent', 'Leads', 'select');
        });
    }
</script>

<div id="mydiv">
<a id="id1" href="/Redirect.aspx?key=1">select</a>
<a id="id2" href="/Redirect.aspx?key=2">select</a>
<a id="id3" href="/Redirect.aspx?key=3">select</a>
</div>

Open in new window

Avatar of Amandeep Singh Bhullar
Amandeep Singh Bhullar
Flag of India image

Avatar of azimuth28
azimuth28

ASKER

I've already check those pages
Thanks anyway
I don't know if my functions are setup wright in order to accomplish my goal. To track the clicks on the "select" hrefs in Event tracking reports
ASKER CERTIFIED SOLUTION
Avatar of azimuth28
azimuth28

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Solved
Solved how?