Sub topic 2
Outbound Clicks, Site Search, Video, and File Downloads in GA4
This chapter assumes you have a GA4 web data stream with the Google tag installed, know the GA4 event and parameter model, and can read basic HTML. Enhanced measurement turns on these events in the data stream settings, so you do not need custom code for them.
Outbound clicks and how GA4 decides a link is outbound
Enhanced measurement sends a click event when a visitor follows a link to another domain. GA4 compares the link's domain with the domain of the current page. If they differ, the event carries outbound set to true. The event also records link_url, link_domain, link_classes, and link_id.
Site search and query parameter settings
When a page URL contains a search term, enhanced measurement sends view_search_results with a search_term parameter. GA4 looks for common names such as q, s, search, query, and keyword. If your site uses another name, such as term, add it under the site search settings of the data stream.
Video engagement for embedded YouTube players
GA4 tracks YouTube embeds only when the iframe URL includes enablejsapi=1.
<iframe
width="560" height="315"
src="https://www.youtube.com/embed/VIDEO_ID?enablejsapi=1"
title="Product walkthrough"
allowfullscreen></iframe>With this setting, GA4 sends video_start, video_progress at 10, 25, 50, and 75 percent, and video_complete. These events include video_title, video_url, video_provider, and video_percent.
File downloads and recognized file extensions
GA4 sends file_download when a visitor clicks a link to a file with a recognized extension, such as pdf, docx, or zip. The event records file_name, file_extension, and link_url. A file whose extension is not on the list does not trigger the event. You can review and edit the list in the data stream settings.
Exercise
Exercise
A page embeds a YouTube video with the URL https://www.youtube.com/embed/abc123 and a visitor watches it to the end. Which video events do you expect in DebugView, and why?
Show answer
No video events appear. The URL lacks enablejsapi=1, so enhanced measurement cannot track the player. Add the parameter to the src attribute, reload the page, and then check DebugView for videostart, videoprogress, and video_complete.