Passing multiple tags to _trackEvent

Is it possible to transfer more than one label in one call to _trackEvent(category, action, label, value) so that it can be used in the report as a separate one as a separate size or for filtering purposes?

My requirement is to track clicks (downloads) of clicks for documents associated with many metadata parameters (document identifier, product identifier, category, language, version, etc.), and all these parameters should be available in custom reports.

Thanks in advance for your help.

+4
source share
2 answers

GA is not configured to track data with granular data about any one element.

And, since GA uses gif requests to send data, you may run into a limit, given the amount of data you want to send.

One way to keep track of all the data you want to use is to move the data to the database using an ajax request.

If you need to use GA for this, you can send multiple _trackEvents for each or group metadata elements based on the document. A setTimeout should be used so that GA has time to send events. See Can I track multiple Google Analytics events at once?

In your case, you will use:

  function recordOutboundLink(link, category, action) { _gaq.push(['_trackEvent', 'Click', 'Download', 'Whatever']); //could be mutlipush here setTimeout('document.location = "' + link.href + '"', 100); } 

HTML

 <a href="http://www.example.com/pdf.pdf" onClick="recordOutboundLink(this, 'Outbound Links', 'example.com');return false;"> 

Also install Chrome and the Google Analytics Debugger . Look at the console (control, shift, j) to handle event tracking.

enter image description here

If you do not see all the event tracking there (they will be listed separately), then something may happen, possibly with the tracking code.

+3
source

I found in the docs API that the same goal (tracking multiple key-value pairs sent in a single _trackEvent request) can be achieved using custom variables:

 _gaq.push(['_setCustomVar', 1, 'Items Removed', 'Yes'], ['_trackEvent', 'Shopping', 'Item Removal']); 

One of the important limitations of this approach is up to 5 maximum number of user variables (or up to 50 advanced user variables for Premium GA Account )

+2
source

Source: https://habr.com/ru/post/1400587/


All Articles