javascript - Tracking events (or virtual pageviews) in Analytics won't work -
Hi, I'm trying to set GA to track events (pageviews will also work) Open some PDF files near my page.
This is the code I have included in every page
& lt; Script & gt; (Function (I, S, O, G, R, A, M) {i ['GoogleAnalyticsObject'] = R; I [R] = I [R] || function () {(I [R]. C = I [r] .q || []). Push (argument)}, I [R] .L = 1 * New date (); a = s.create element (O), M = S. ElementElementBitagname (O) [0]; a.async = 1; a.src = g; m.parentNode.insertBefore (a, m)}) (window, document, 'script', '// www.google-analytics.com/analytics. Js', 'ga'); GA ('Make', 'UA-15438479-1', 'Disicia.it'); Ga ('Send', 'Pageview'); & Lt; / Script & gt; & Lt; Script & gt; $ ("A [href = = 'pdf']") Click (function () {_gaq.push (['_ trackEvent', $ (this) .attr ('href')]);}); & Lt; / Script & gt; Now, when I look at real-time event tracking, or even last event tracking (I was involved this 3 days ago) it does not report any incident. If I try to trackEvent with TrackApview and change it, then it does not work anyway. If it is of some use, then the encoder I am working on is ASP.NET and GA code contained in the lower part of the page. Clearly the standard report works properly.
I do not know what to do, please help me.
Thanks in advance.
You are mixing analytics version, which will not work ()
The correct syntax for event tracking in Universal Analytics
ga ('Send', 'Event', 'Category', 'Action', 'Labels', Value) ; Where labels and values are optional (this should be an integer if you use the value). .
Most commonly, if you have ga () in your tracking code, then you can not use _gaq.push () to call the Analytics method.
Comments
Post a Comment