Categories
Public

GA Filter to Remove Data Artifact from Expandable Content Area Event Label

In which: we implement a Google Analytics filter to clean-up a class of data artifacts in the Event Label field for our expandable content area events.

Background

The Mason Standard Google Tag Manager Container includes functionality to send tracking events to Google Analytics when a user clicks on an expandable content area on a tracked website. Data sent as part of these events include:

Event Category: expandable content
Event Label: [actual text of the element being clicked]

On many websites, the clickable heading may include some explanatory text indicating to the user that the content can be expanded. For example, on Mason Drupal Platform websites, the expandable content area headings include the label “More +” when the content is hidden, and “Close -” when the content is visible.

In most cases this works fine. But under some conditions, the browser sends the text of the explanatory label as part of the Event Label. In the case of Internet Explorer, the browser includes the text “more less” after the actual website label text.

Solution

We will implement a filter to clean up the extraneous “more less” text at the end of the Event Label field for hits from Internet Explorer.

Filter

Filter Name: Remove: “more less” from end of event label field for Internet Explorer
Filter Type: Custom -> Advanced
Field A: Event Label: (.*) ?more less$
Field B: Browser: Internet Explorer
Output To: Event Label: $A1

Notes

This will affect all hits which include data in the Event Label field (so, all events) for which the browser is Internet Explorer. Because of the practical limitations of Google Analytics filters, we are not specifying that this filter only applies to hits with “Event Category” = “expandable content”. However, only expandable content area events are likely to include this text at the end of the event label field.

Example Data

Account: Mason Office of Communications and Marketing 01
Property: www2.gmu.edu
View: [PROD] www2.gmu.edu – default 2.0 (2017-06-25)
Date Range: Oct. 6, 2018 – Oct. 8, 2018
Segment: none
Report: Behavior – Events – Top Events
Segment: expandable content
Primary Dimension: Event Label
Filter: ^undergraduate

Data (PDF)

Notice that some of the event labels include the text “more less” at the end.

After Filter

Account: Mason Office of Communications and Marketing 01
Property: www2.gmu.edu
View: [PROD] www2.gmu.edu – test view 01 (2017-06-25)
Date Range: Oct. 6, 2018 – Oct. 8, 2018
Segment: none
Report: Behavior – Events – Top Events
Segment: expandable content
Primary Dimension: Event Label
Filter: ^undergraduate

Data (PDF)

Notice that there are no longer any records with an event label ending in “more less”, and the corresponding labels have had their Total Events quantity increased by the corresponding amounts.

Segment: Browser: Internet Explorer

Notice that Internet Explorer data has been corrected.

Leave a Reply

Your email address will not be published. Required fields are marked *