Hi I'm trying to set GA to track as events (pageviews would work too) the opening of some pdf files I have on my page.
This is the code I include in every page
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-15438479-1', 'discinesia.it');
ga('send', 'pageview');
</script>
<script>
$("a[href$='pdf']").click(function(){
_gaq.push(['_trackEvent', $(this).attr('href') ]);
});
</script>
Now, when I see real time event tracking, or even past events tracking (I included this 3 days ago) it doesn't report of any event. If I try and change trackEvent with trackPageview, it doesn't work anyway.
If it's of some use, the environment I work into is ASP.NET and the ga code is included in the bottom of the page. Obviously the standard report works correctly.
I really don't know what to do, please help me.
Thanks in advance.