简体   繁体   中英

Click tracking of a newsletter using Google Analytics and without a website

I would like to know if it is possible to use Google Analytics to track links that do not necessarily relate to a specific website?

In other words, if I make a newsletter with a hyperlink to www.shinyhappypeople.com , how can I equip this hyperlink so that a click event on the link will be recognized and tracked by my Google Analytics account?

You're looking for event tracking. You can bind an event tracking call to absolutely any interaction with a webpage (or non-interaction such as firing an event after a predefined period of time - remember to set the 'non-interaction' flag!).

The basic code for event tracking is as such:

ga('send', 'event', '[category]', '[action]', '[label]', [value]);

So if you have a HTML anchor element (hyperlink) you will want to bind this to the onclick event. I'll demostrate this by hardcoding it, but you could dynamically bind using native JS or something like jQuery of course:

<a href="http://www.shinyhappypeople.com" onclick="ga('send', 'event', 'User Interaction', 'link-click', 'shinyhappypeople.com', 1);">click me</a>

For full details of everything you can do with event tracking just see the Google Docs here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM