When it comes to your marketing strategy, knowing who is ready to buy helps you:
- Target your ads better. No more wasting money on clicks from people who are just going to leave your site instantly. Focus your ads exactly on people who are likely to buy.
Event tracking is essential to a strong, data-driven marketing strategy that works — it saves you money by reducing wasted clicks, and grows your good idea by attracting more engaged customers. The best part is it's pretty easy to set up.
Step 1: Add Google Analytics 4 to Your Site:
Event tracking works through Google Tag Manager. A Tag is a fancy way of saying ‘a piece of tracking code’, and GTM installs different pieces of tracking code in your website to give you access to your website’s data.
Before you set up event tracking in Google Tag Manager, you need to have Google Analytics 4 installed on your site. It’s free and provides a place for you to view all your data. Make a Google Analytics account.
In Google Analytics, head to Admin and find the Data Streams section. If you don’t have one, add a Web data stream, and grab the Measurement ID (looks something like G-123456789). Save this, you’ll use it in a second to connect Google Analytics to Google Tag Manager.
2. Set Up a Google Tag Manager Account
Google Tag Manager is like a cousin to Google Analytics. It’s free and helps track your data. Head to Google Tag Manager and set up an account and a container.
You’ll get a little snippet of code to paste into your website. Most platforms like Webflow and Shopify have easy ways of doing this, just follow their instructions and you’re good to go.
Step 3: Create a Google Analytics Tag in Google Tag Manager
Now we connect GA4 to GTM by adding a Tag (tracking code) for Google Analytics. GTM will inject this code into your website when the website loads, and start tracking your data from there.
- 2. Under Tag Configuration, click the pencil to edit. This will open a Choose Tag Type menu. Choose Google Analytics and then Google Tag.
- 3. In Tag ID, paste the Google Analytics Measurement ID that you saved from Google Analytics earlier.
- 4. Go down to Triggering and click the pencil. In Choose Trigger select All Pages (type Page View). This means it will load the Google Analytics tag into your website the minute the page is viewed by a user.
Step 4: Create a GA4 Event Tag in Google Tag Manager
Well done! You’ve installed Google Analytics. Now comes the fun part — setting up events. We’ll start by tracking conversions. First we define the event that will show up in Google Analytics every time a person makes a purchase. Then we’ll define the ‘trigger’ that triggers that event (i.e. clicking on your website’s BUY button.)
- 4. In Measurement ID, paste the same Google Analytics Measurement ID that you pasted in from Google Analytics earlier.
- 5. In event name, write a name for the event in lowercase, with underscores instead of spaces. For example, click_book_a_call.
Google has a bunch of recommended events - it’s a good idea to use these if you can. Google Analytics takes the events and puts the data into different reports, like the Purchase Journey report (under Reports > Sales or Monetization in Google Analytics). It relies on you using the recommended event names, and then it takes the data that those event names track and uses it to make those reports excellent. More on this later.
We’re going to start by tracking conversions. For most businesses this is when a customer buys something. For some high-value businesses it’s when they place an enquiry, book a phone call or schedule a demo, then you start the sales lead generation process. So recommended event names like ‘generate_lead’ or ‘purchase’ might work for your purposes.
Under More Settings tick Ecommerce > Send Ecommerce data. This can include the price of different purchases if it’s set up correctly.
Next, you need to tell GTM when to track the event. This is done by setting a trigger.
- 4. In Trigger type, click the pencil. There are a bunch of triggers you can choose from. If you want to capture users that click the Buy button, select Click — All Elements. If you want to capture users that view the Success page after purchasing, select Page View.
- 6. Set Page Path — contains — the end of the URL that your Buy button is on. i.e. For https://www.mywebsite.com/shop/bunny-slippers paste /bunny-slippers in here. It’s case sensitive so make sure there are no mistakes.
- 7. Click the + sign and add a new condition: Click Text — contains — BUY. This is case sensitive too so make sure it exactly matches the text on the button. You may want to Inspect the button’s code if you know how and make sure it’s spelling and capitalization are the same as they are in the code. If you’re used to diving into the code, other options for identifying this button are to set Click ID to the id of the button, or set Click Class to one of the classes on the button.
- 9. Go back to Tags, open your unfinished tag and add your new Click Buy Button Trigger as the trigger.
Before publishing your tag, make sure it works! GTM has a handy Preview mode where you can visit your website and test whether your tag fires correctly when someone clicks the button or takes the action you’re tracking.
Once you're confident it's working, click Submit in GTM to publish your tag. GTM makes a record of all your changes so you can roll them back if you need to. Write a short message explaining the changes you’ve made, i.e. ‘’Set up GA tag and first Event tag tracking clicks on buy button.’ Then click Publish.
Step 7: Check Event Data in GA4
Go to your website and click the button. Then head back to your GA4 account to see your event data rolling in. You may need to wait 24 hours. Then, under the Events section (located in Reports > Engagement > Events), you should start to see your purchase or generate_lead appearing.
Once those events are working you can start analyzing what’s working on your site and who your paying customers are. I’ll explain how to do this in the next blog.
With event tracking, you’re not just guessing who’s ready to engage with your product—you know. And once you know who’s really interested in your idea, you can target your ads to the people who matter, making sure every marketing dollar is well spent.
LaunchBot helps you focus your marketing strategy on your paying customers! Try for free now.