Table of Contents
This section is about tracking visitors to add sites to favorites
Principle: The page listens to the event when the user clicks the favorite, and then configures the corresponding action in Google Tag Manager to trigger sending data to google analytics.
1、Create custom HTML
Create custom HTML in Google Tag Manager, and then copy the following code into it:
The function of this code is to monitor the user’s behavior of adding the website to favorites, and send the event AddToFavorites when triggered, You can see that there is keyCode in the code. This is the operation of the user on the keyboard. Using a similar principle, you can track some of the keyboard operations when the user visits the website.
Select All Pages as the trigger. The effect after copying the code is as follows：
Set a custom event trigger to accept the previously emitted event AddToFavorites
Here is the name of the event you sent in the previous step.
Set an event that is triggered when a user adds a favorite and sends data to Google Analytics. The specific configuration is as follows:
Track Type is event, because it is for event tracking. Set the event to a non-interactive type. The trigger is AddToFavorites
Click Preview in the upper right corner and open http://www.bbccss.com to add the website to your favorites:
The existing code is only applicable to the tracking of the Window and Linux system, and the Mac cannot temporarily track it. I am researching how to track on MAC.