Track Add Websites to Bookmarks in GTM

Google Tag Manager BCS 7 years ago (2019-12-19) 3657 Views 0 Comments
文章目录[隐藏]

Updated: March 16, 2026

Bookmarks are a strong signal of user engagement. When visitors add your website to their bookmarks, it often indicates that they plan to return in the future.

However, browsers do not provide a direct API to track bookmark actions. With a small JavaScript workaround and Google Tag Manager (GTM), we can still detect when users attempt to bookmark a page using keyboard shortcuts and send this event to Google Analytics 4 (GA4).

This article explains how to implement bookmark tracking using GTM + JavaScript + GA4.

How Bookmark Tracking Works

The idea behind this method is simple:

  • 1、Inject a JavaScript listener using a Custom HTML Tag in GTM.
  • 2、Detect when users press the bookmark shortcut keys.
  • 3、Push a custom event into the dataLayer.
  • 4、Send the event to GA4 using a GA4 Event Tag.

The typical keyboard shortcuts for bookmarking are:

  • Ctrl + D (Windows)
  • Command + D (Mac)

When these shortcuts are detected, a custom event will be triggered.

Important Limitations

Before implementing this method, you should understand its limitations:

  • Browsers do not provide an official API to detect bookmark actions.
  • This method only detects when the user presses the bookmark shortcut.
  • When the shortcut is pressed, the browser usually displays a bookmark confirmation dialog.
  • Because this dialog is controlled by the browser, we cannot know whether the user actually confirms and saves the bookmark.

In other words, this method tracks bookmark attempts, not confirmed bookmarks.

Use Cases for Bookmark Tracking

Tracking bookmark attempts can provide useful insights, such as:

  • Identifying high-value content users want to revisit
  • Measuring user loyalty and engagement
  • Finding pages users intend to return to
  • Evaluating content quality and usefulness

Although it does not guarantee a confirmed bookmark, it still serves as a strong engagement signal.

Step 1: Inject JavaScript with a Custom HTML Tag

In GTM , click「Tags」——「New」——「Choose a tags type to begin setup…」——「Custom HTML」,Name the tag “HTML-Bookmark”, and add the following code.:Track Add Websites to Bookmarks in GTM

This script listens for Ctrl + D or Command + D and pushes a bookmark event into the dataLayer.

Step 2 : Set Up the Trigger

In GTM , click「Triggers」——「New」——「Choose a trigger type to begin setup…」——「Custom Event」,Name the trigger “Bookmark”, and configure it as shown below:

Track Add Websites to Bookmarks in GTM

 

Step 3: Create the GA4 Event Tag

In GTM , click「Tags」——「New」——「Choose a tags type to begin setup…」——「Google Analytics: GA4 Event」Name the tag “GA4-Event-AddtoBookmark” and configure it as follows:Track Add Websites to Bookmarks in GTM

Then select the Bookmark trigger created in Step 2.

Step 4 : Preview and Publish

Next, use Preview mode in GTM to test the implementation.

Track Add Websites to Bookmarks in GTM

During debugging, you should see the tag fire when the bookmark shortcut is pressed. If everything works correctly, you can publish the container.

 

Step 5: Verify Data in GA4 Reports

In most cases, the event data will appear in GA4 reports within 24 hours, for example:Track Add Websites to Bookmarks in GTM

FAQ

Can GA4 track bookmarks directly?

No. Browsers do not provide an API that allows analytics tools to detect bookmark actions.

Does this track confirmed bookmarks?

No. It only detects when users press the bookmark shortcut keys.

Does this work on all browsers?

It works on most modern browsers, but behavior may vary slightly depending on browser security policies.

Like (1)
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