[ Google Analytics ] create custom tracker

normal tracker

ga('create', 'UA-XXXXX-Y', 'auto');

create custom tracker

ga('create', 'UA-XXXXX-Y', 'auto', {'name': 'myTracker'});

declare custom dimension

ga('myTracker.set', {
'dimension1': 'Publish Date',
'dimension2': 'Author'
})

send event

ga('myTracker.send', 'pageview', {
'dimension1': post.publishDate,
'dimension2': post.author
});

We can also send pageview.

 ga('send', 'pageview');

ref : https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s