Notes

Pageviews & Virtual pageviews (dynamic / AJAX).

UjnotesCC0 1.0

Pageviews & Virtual pageviews (dynamic / AJAX).

Include code initializer in <head>

Ref

Pageviews & Virtual pageviews (dynamic / AJAX).

SPA should not update the window.location as it will interfere with tracking params and result in artifacts like new sessions in tracking report.

ga.js

if(!(typeof (_gaq) === "undefined")) {

_gaq.push(['_trackPageview'], "/"+URLid);.

}.

Analytics.js.

Ref

https://developers.google.com/analytics/devguides/collection/analyticsjs/

Ga('send', 'event', {.

'eventCategory': 'download',

'eventAction'. 'click'.

});.

Non-Interaction Events.

Bounce rate calculation

However, when this value is set to true, the type of event hit is not considered an interaction hit.

ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {

nonInteraction. True.

});.

If not specified, the default value is false, which implies that the event is AN interaction event and thus should be included in bounce rate calculation. So if the user were to interact with such an event - his session would not be regarded as a ‘bounce’.

Bounce rate

At least one interaction.

Outbound.

Once link is clicked - current page js stops executing.

function handleOutboundLinkClicks(event) {

ga('send', 'event', {

eventCategory. 'Outbound Link',.

eventAction. 'click',.

eventLabel. Event.target.href,.

transport. 'beacon'.

});.

}.

Transport beacon for supported browser.

Non supported, wait till event is transmitted.

The onclick should return false, the actual page loading is done by 'hitCallback': function(){document.location = url;}.

var trackOutboundLink = function(title, url) {

if(!(typeof (ga) === 'undefined')) {

if(!(typeof (title) === 'undefined'))

Title = url;.

Ga('send', 'event', 'outbound', 'click', title, {.

'transport'. 'beacon',.

'hitCallback'. Function(){document.location = url;}.

});.

}.

}.

Events

https://support.google.com/analytics/answer/1033068#Anatomy

Extension.

https://github.com/googleanalytics/autotrack

To centralize common utility code.

Updated: 2026 Aug 19