Bulk Event Tracking——ga-data Method | BCS

Bulk Event Tracking——ga-data Method

Google Analytics BCS 8 months ago (12-08) 211 Views 0 Comments

This section describes how to do batch event tracking, that is, a tag triggers multiple events. If each event tracking has to be located one by one, the workload is relatively large and tedious. Now we introduce a method that can track events in batches.

Suppose there are several locations on the blog that need to be tracked for events. The specific locations are as follows:

Bulk Event Tracking——ga-data Method

There are four places to do event tracking.

Setup Process

1、Add ga-data attribute

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

Bulk Event Tracking——ga-data Method

 

Let the colleague of development add the ga-data attribute on it, such as ga-data = “1”. Each location that needs to be tracked needs to be added and assigned a value. The effect after adding is as follows:

Bulk Event Tracking——ga-data Method

 

2、Setting Variables

Need to set three variables

element

Create a User-Defined Variables Auto-Event Variable and name it element,Variable Type set as Variable , The specific configuration is as follows:

Bulk Event Tracking——ga-data Method

Custom JavaScript

Create a Custom JavaScript, then copy the following code into it and name it Get-ga-data:

<span style="font-size: 12pt;">function() {
	var elem = {{element}},
	    attr = "ga-data", // change this to the attribute that you want to get
        result = (elem.getAttribute && elem.getAttribute(attr)) || null;

	if( !result ) {
		var attrs = elem.attributes,
			l = attrs.length;
		for(var i = 0; i < l; i++) {
			if(attrs[i].nodeName === attr)
				result = attrs[i].nodeValue;
                }
	}

	return result;
}</span>

The specific configuration is as follows:

Bulk Event Tracking——ga-data Method

Lookup Table

Create a lookup table and name it Lookup Table-ga-data:

Bulk Event Tracking——ga-data Method

 

Input Variable Select Get-ga-data; Input is the ga-data value set previously , It is the value in ga-data = “1”,  and output can be customized for specific locations:

 

Bulk Event Tracking——ga-data Method

 

2、Setting Triggers

Create a Click-All Elements trigger, select Some Clicks, named as Bulk:

Bulk Event Tracking——ga-data Method

The range of the trigger condition is the value range in ga-data, which is why the value is used in ga-data. More convenient positioning.

 

3、Setting Tags

Make the following settings:

Bulk Event Tracking——ga-data Method

4、Preview

Bulk Event Tracking——ga-data Method

 

On the real time report back to Google Analytics:

Bulk Event Tracking——ga-data Method

The data was also received.

We done!

 


If you don't understand, You can leave a comment below or email me (haran.huang@ichdata.com).
Like (0)
Post my comment
Cancel comment
Expression Texture Bold Strikethrough Center Italic Sign in

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

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