Event Tracking——Method Of Binding Class | BCS Event Tracking——Method Of Binding Class | BCSBCS

Event Tracking——Method Of Binding Class

Google Analytics BCS 5 years ago (2019-12-09) 1882 Views 0 Comments

This section introduces another method of tracking events——the method of binding classes. The advantage of this method is that you do event tracking later. You only need to create a tag bound to the class to implement event tracking.

Suppose what I want to track is here, click on the homepage:

Event Tracking——Method Of Binding Class

Setup Process

1、Find class

Move the mouse to the position you want to track, then right-click and select Inspect:

Event Tracking——Method Of Binding Class

 

Then copy the value of class.

2、Create A Tag

Create a custom HTML tag and name it: Event Tracking——Class,Then copy the following code into it.

<span style="font-size: 12pt;"><script>
     $(".g-mono").click(function(){
    dataLayer.push({
   event:"click-ga",
   eventCategory:"Click",
   eventAction:"HomePage",
      eventLabel:"Test"
}); 
})
</script>
</span>

Trigger Select All Pages:

Event Tracking——Method Of Binding Class

The place surrounded by the red box in the figure above is to fill in the class. Fill in whatever your class is. Others such as Category, Action and Label can be customized later.

2、Create A Trigger

Create a trigger for a Custom Event:

Event Tracking——Method Of Binding Class

The event name depends on what you called the event in the previous step. It must be consistent, here is click-ga

3、Create data layer variables

Create a data layer variable, and then make the following settings. The Data Layer Variable Name is the name that is defined in the first step, and must be consistent:

Event Tracking——Method Of Binding Class

eventCategory, eventAction, eventLabel, all three need to be created:

Event Tracking——Method Of Binding Class

 

4、Create A Tag

Create a Tag and set it as follows:

Event Tracking——Method Of Binding Class

Save!

5、Preview

Click Preview in the upper right corner to test.

Event Tracking——Method Of Binding Class

 

The event was triggered.


If you don't understand, You can leave a comment below.
Like (2)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website