Scraping A Used Car Dealer’s Vehicle Year, Make Model & Stock Numbers With Google Tag Manager

I’ve been using Google Tag Manager for quite some time and I’ve learned so much since I started. I love Tag Manager because of the events I can track and send back to a website’s Google Analytics. I then use them for analyzing and create awesome remarketing audiences. I like to measure engagement, not just visits. It’s easy to get traffic to certain pages of your website but it’s important to measure how they engage.

I’ve been working the internet since 1994, so I’m a little more advanced than the average marketer. But I am not a programmer, and there are many things I don’t understand. I’m going to keep this as simple as possible and I’ll show you screenshots of my tags so you can just copy them.

Car Inventory Views Vs Engagement

Every car dealer has a vehicle inventory page. This is commonly referred to as a “VDP”. The first image below shows the total number of VDP Views from yesterday. The second image shows VDP views that visitors engaged with. In this case, my engagement is any visitor who spent at least 30 second on the page.

All Vehicle Detail Shoppers

VDP Vehicle Detail Pages All Users

All VDP Visits

Engaged Vehicle Shoppers

Timed VDP Vehicle Detail Page Visits

Timed VDP Visits

Note the difference?

Keep in mind, this is a huge car dealer that gets 3,500 website visitors a day and they have over 2,000 vehicles in stock. When you start looking deep like this, you will start thinking in the right direction.

The most visited vehicle was a 2011 BMW 3 Series. 30 unique internet car shoppers looked at this vehicle yesterday. If you look at the second table above, 23 of them were engaged with the page. So it wasn’t the most popular engaged car. The 2016 Honda Accord was the winner with the most engagement.

Remember, this is only one day. Imagine what it will look like after a month?

Step One: Scraping With Google Tag Manager?


I am scraping the vehicle stock number AND the vehicle year make model.

Scraping The Stock Number

New Data Layer Variable Titled “Stock Number”.

Scraping Stock Number

By leaving Attribute Name blank the data that is scraped will be added here when it fires.

Element ID Or CSS Selectors?

If one doesn’t work, try the other. It’s a lot easier than learning what the heck these are. I found the ID by viewing the source code, hitting control F and searching “id”. I’ll usually first look at the element using Google Chrome’s Developer Tools but in this case it didn’t help.

Element ID:

<div class="hidden" id="carstocknumber">82815</div>

Scraping The Vehicle Year Make Model

New Data Label Variables titled “Vehicle”

Vehicle Make Model DOM Element

Element ID

<div class="hidden" id="titlepagemmdf">2015 TOYOTA CAMRY - SE </div>

If what you want to scrape is listed as an H1, this will even be easier for you. Just change the selection method to “css selector” and simply put h1 in the Element ID Field. It’s super easy. In my case, it wasn’t that simple. So I found the best way was the scrape what they identify for the pages title tag. In this case, the blank attribute will scrape “2015 Toyota Camry – SE”.

What The Heck Did We Just Do?

In the last step, our final event label will be {{Stock Number}} – {{Vehicle}}. So the event label we will push back into analytics will be 82815 – 2015 TOYOTA CAMRY – SE. Keep reading for a better understanding.

Step 2: Setting Up Triggers In Google Tag Manager

When do we want these triggers to fire? We don’t want these to fire on every single webpage or we will get many “nulls”. I only want these to fire and scrape when a vehicle detail page is visited.

Let’s look at a VDP URL.

Since every time a specific vehicle is visited the url will change, but there are two different strings that don’t change.

“/carsforsale/” AND “FL-Stock”

So, I will use a regex match, like below.

Timed DVP Trigger

My trigger instructions are simple.

Wait 30 Seconds Before You Scrape

I am telling Google Tag Manager to NOT fire the trigger for 30 seconds, which is 30000 milliseconds. When the 30 seconds is up, any stock number present will be scraped. If the visitor is gone, there is nothing to scrape.

Setting A Limit

I don’t like measuring the same person who does the same thing, more than once. If I kept this field blank, it would keep firing every 30 seconds. So if I left the page open for 20 minutes, it would fire 40 times.  So there would be 40 events and only one user. This is why I put “1”.

OK, 30 Seconds Are Up. What Do I Do Now?

Scrape the stock number. I am using “.*” to say I don’t care what it says. Whatever is there just scrape it. I know it will only be a stock number BUT only scrape when the URL has “Fl-Stock.*” present in it.

Step 3: The Tag

Now, let’s put it all together.

The Google Tag

I’m sending events back to Google Analytics so my track type will be “Event”. The event category will say “Vehicle” and the event action will say “Timed Stock Number”, in Google Analytics. This is where I will go to see my data.

The Label Is Pulling The Scraping Data We Did In Step One.

The label will have the stock number and the vehicle added to it. it’s important to include the stock number because a day may have two of the same vehicles.

This Is What It Will Look Like In Google Analytics

Event Labels In Google Analytics

The Final Product

The first two images of this article show same data. Only we are displaying it in Google Data Studio. The only difference being it is sorted by total events. I would always sort by Unique Events because that’s all I care about.

What Will I Do With This Data?

This data will be useful to the owners, the auction vehicle buyer, the internet marketing director and the website administrator.

Least engaged vehicles

Now we can look at what vehicles are not getting any engagement. Why are few people engaging with that 2014 Jeep Cherokee?

  • Is it buried too deep in the website?
  • Does it have too many miles?
  • Is the price too high?
  • Should we create campaigns to get visitors to these vehicle detail pages?

This Is Why We Scrape Prices As Well

We scrape prices as well. It's nice to know the price ranges of the vehicles your potatial customers are looking at.

The most popular vehicle price is $14,999. Dealers will want to aim for this price point.

I scrape payments, vehicle colors and many other things, I have all the data I need to help this dealer sell more cars.

Car Color Scraping

What If We Stocked More Black Vehicles At A $15,000 Price Range? Our Sales Could Double.

Learning More About Google Tag Manager Resources

The Internet Authority : Simo Ahava |

If you Google specific Tag Manager issues, you will see more of Simo than anyone. He’s also very helpful in the Google Tag Manager Forum.

YouTube Authority : Julian From Measure School | YouTube Channel

If you like watching videos, Julian, from Measure School has some great ones.


When a new tag is created, it will not go backin time and record data. It will be from this moment on. If you have a website with a lot of traffic, this type of thinking is essential. It’s also essential if you plan on getting more traffic, perhaps by paid search and display solutions.






About the Author

I've been working in digital marketing since 1994. I'm the original founder of Showroom Logic based out of Miami Florida, which was the 26th fastest growing private company in the United States in 2015. It was also the fastest growing marketing company in all of the US. In 2016 I sold by shares and moved back to Massachusetts.