Amazon eBook Clicks Tracking with GTM
In this article, we are going to track “Read Sample” button clicks with GTM. To let you explore the webpage and button, here are some guidance:
- Go to https://amazon.com
- Go to Kindle E-readers & Books
- Go to Kindle Books
We are going to work on a page seen below.

The book that I selected to see in GTM preview mode:

First of all, we are doing GTM preview mode and clicking on “Read Sample” button of one of the books. Please enable all click related built-in variables if you did not enable so far.

We don’t see any unique Click ID. So, Click Class seems right option to select for creating trigger. So lets create the trigger we need.

The trigger looks something like the screen shot above. Also, I want to see the book’s name in my GA4 event tag as a parameter, but how to see it? In this step, we can benefit from page path. First part of the page path looks like book’s name ( Housemaid-Watching-absolutely-gripping-psychological-ebook). To extract only first part of page path, we need to create custom JavaScript variable. The code is below.
function() {
var partialPath = {{Page Path}};
var match = partialPath.match(/\/([^\/]*)/);
if (match && match[1]) {
return match[1];
} else {
return null;
}
}
This code extracts only part between first “/” and second “/”. I named the variable as cJS – Book Name.
Now, it is time for creating our GA4 event tag.

I assumed that you already created your Google Tag containing your analytics measurement ID. I named the event as readSample_click. Created book_name event parameter and added the trigger we created at first. Don’t forget to register book_name as a custom dimension in your GA4 property. Now, it is time for testing.
Testing
GTM Preview Mode
In preview mode, I tried 2 different books. As seen below, both tags are fired successfully and naming convention is working well for the other book as well.


GA4 Debug View
This test method is one of the most crucial ways. If you pass this test, it is 99% that your property is receiving correct data. We need to go to Admin -> Debug View. If we see our event and related parameters here, the test is passed.

Preview Mode Google Hits
Another way to test events is checking hits by clicking Google Tag in preview mode. We see that there are 2 different hits for 2 button click event tags fired. When open hits, we must see proper event name, event parameters and other information.

Developer Tool – Networks
In Network part, it is important to enable Preserve log button. This will catch the button click hits before the new page loads and hits go away. After clicking button, we see 2 Google Analytics hits. One is related to page view, and the other one is related to our event. Bottom of the request URL, “en” stands for event name and “ep” stands for event parameter. Both fit to our event, so there is no obstacle in this test method.

So overall, tests are working good. We will be ready to analyze our data on GA4 reports. This article was a practical illustration of implementing new event on Amazon website.