How To Use Events To Optimize Your Facebook And Google Ads Campaigns

No Comments

Your website is bustling with activity. Visitors are constantly interacting with your website.

But are you taking full advantage of everything that’s happening on your website for your paid marketing? 

Every interaction of a visitor with your website – a pageview, a click – can be used to better understand your audience

And when you understand your audience better you can target them in a smarter way, and get more bang for your buck from your paid campaigns on Facebook and Google.

Both Facebook and Google refer to these user interactions as Events. They allow you to track them using a tracking code installed on your website.

What Are Events

Events are user interactions that don’t involve loading another page on your website.

In ecommerce, the prime example of an event is Add to Cart.

Another event can be filling out a field in a form. As opposed to form completion that usually triggers a Thank You page, filling out one or more fields without submission – referred to as ‘form abandonment’ – can be recorded as an event.

More examples of events are: watching a video, clicking on mailto email address link, downloading media (such as PDFs).

Why Events Are Important

Events are important because they indicate higher intent of your website visitors.

If a visitor watched a video on your website, it demonstrates an interest in your offering. 

Basically, any user interaction on your website can contribute to better understanding the user level of engagement with your brand, and the intent on moving down the funnel.

In ecommerce, even if a visitor did not complete a purchase, the abandoned cart shows a high purchase intent. Something has prevented the visitor from completing the purchase, but such a visitor is definitely worth your attention. 

By tracking events you’ll be able to make a more focused offer to this user in your paid campaigns.

How? By injecting the events tracking data into your paid campaigns and using this data for more precise targeting and optimized offering.

Think about it – if you can group together all the visitors who watched a certain video and set up a customized campaign for them that reference what they saw in the video, wouldn’t that make for a far more effective campaign than a generic awareness message?

It sure will.

So that’s exactly what we’ll go through in this article: how to use event tracking to get more out of your ad campaigns on Facebook and Google.

How to Set Up Events on Your Website

With both Facebook and Google, you’ll need to use code for setting up events on your website.

Yes, unfortunate but true.

Setting up events isn’t the most complex coding task, but since you are dealing with your website code any mistake can cause havoc. So this task needs to be handled by your development team.

Events Set Up Using Facebook Pixel

Standard events on Facebook include:

  • View content
  • Search
  • Add to cart
  • Add to wishlist
  • Initiate checkout
  • Add payment info
  • Make purchase
  • Lead
  • Complete registration

First you need to verify that you already have the Facebook Pixel code embedded in the header code of every page of your website, between the <head> and <head> tags. If you don’t, first go ahead and insert the base Pixel code.

Next, select the event that you wish to track for a specific page from Facebook’s list of events. Let’s say Add to Cart event, which looks like this: fbq(‘track’, ‘AddToCart’);

Paste the Add to Cart event code above the </script> tag.

Here’s how it should look:

Source: Facebook

  1. Your header code
  2. Your base Facebook Pixel code (the ID number is unique to every website)
  3. The specific event code

You’ll need to repeat this on every page you want to track an event or a few events, for each page inserting the relevant event code.

Here is the official Facebook guide for setting up events.

Events Set Up Using Google Analytics

For event tracking in Google Analytics you’ll need to create custom code snippets for every event.

The code is then added to the link code of the item or action you want to track so when the item is clicked it will be displayed as an event in Google Analytics.

The event code is made of four elements – two required elements and two optional elements:

  • Category (required) – defines a group of actions you want to track
  • Action (required) – the type of action you want to track
  • Label (optional) – for your monitoring convenience, stating what’s the event is about
  • Value (optional) – assigning a numeric value to the event; can be monetary value, or just a scale

The basic structure of an event code looks like this:

onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’, ‘Value’);”

The code should be added within the href link code, before the link text:

<a href=”” onclick=”ga(‘send’, ‘event’, ‘PDF’, ‘Download’, ‘Company Brochure – PDF Download’);“>Download Our Brochure</a>

In the example above no Value was assigned to this event.

Here is the official Google Analytics guide for setting up events.

There Must Be a Better Way

All this event data needs to be injected into your paid campaigns in order to optimize them but before we get into that, let’s talk about the elephant in the room.


Dealing with code isn’t ideal for marketers. It’s just not our forte. 

It holds us back since constant optimization is one of the core principles of online marketing. 

And when you need your development team for every act of optimization, well, it’s not ideal.

So is there a better way to track events on your website? Apparently there is.

There’s a tool called Oribi that offers exactly that – no code event tracking. 

Oribi tracks every interaction on your website, page views and button clicks, automatically. It collects all this data and makes it all available to you. Even when you make changes to your website, like adding a page or changing buttons, events are updated dynamically. As said, all of this is done without any code business on your behalf. 

Here’s how event tracking looks in Oribi:

The value here is apparent. You don’t need to decide which events to track, and you don’t need your development team to track it for you. Everything is tracked for you. You just need to follow the data.

Using Event Data to Optimize Your Paid Campaigns

Now let’s see how to use all this event data, that you collected so diligently, to better segment and optimize your paid campaigns, and get more return on your ad spend.

There are two main objectives for tracking event data:

  1. Internal – being able to analyze how visitors are interacting with your website and from that optimizing the UX (user experience) on your website
  2. External – exporting the data to your paid campaigns to better segment them – group together audiences according to their place in the funnel and specific interests in order to deliver more relevant messages

Let’s look again at the Add to Cart event. As mentioned, adding an item to a cart shows a high purchase intent. These visitors, even if didn’t complete the purchase, declared their interest in your product.

They are ‘worth your efforts’ to continue and court them in the hope they will complete a purchase in the future.

But they are all different, and you can understand that based on the item, or items, they chose. 

If you could, for example, group together all those visitors who added a shirt and then group together those who added a pair of shoes – wouldn’t your paid campaigns for these two distinct groups be so much more valuable? 

Not to mention you could segment them to men and women.

You’ll be able to deliver a highly relevant message, or offering, in your ads.

This is just the tip of the iceberg as far as segmentation and optimization of your paid campaigns that can be achieved with event tracking.

Two Main Use Cases for Ad Campaign Optimization Based on Event Tracking

Both Facebook and Google offer very strong optimization capabilities for their ad campaigns.

There are two objectives for this:

  1. Ability to segment your audience in order to deliver a highly relevant message (the more segmented the audience is, the more relevant your message can be)
  2. Ability to reach new audiences that are also relevant to your offering

Let’s look at how these objectives are achieved through specific features in Facebook and Google ad campaigns.

Facebook’s Retargeting and Google’s Remarketing

The simplest way to explain the Retargeting / Remarketing feature is this:

When you visit a website a tracking cookie is installed on your browser – yes, that’s the famous cookies message you now see everywhere. After you leave the website you begin to see display ads of that website. This must be familiar to basically anyone.

This is the retargeting / remarketing feature. To show you ads of the website you visited on other websites.

The ads can be general, just a reminder of the brand. But they can be more than that. What if they related directly to the content you read on that website? Would that make a bigger impact? Of course it would.

Let’s say you browsed a vacation apartments website. You looked at apartments in Lisbon, but didn’t make a reservation. A couple of days later, while scrolling down your Facebook feed, you all of a sudden see an ad that says “Still thinking about Lisbon?” 

Now that’s powerful. It will stop your scrolling. It will make you think about Lisbon again. If you clicked the ad, it would take you back straight to the Lisbon section of that vacation apartments website.

So by tracking events – in this case browsing a specific page – you are able to deliver highly targeted, super relevant, and hopefully mighty engaging ads to audience that already demonstrated interest in your offering.

Facebook’s Lookalike Audience and Google’s Similar Audience

The simplest way to explain the Lookalike / Similar Audience feature is this:

Based on your audience attributes, Facebook and Google are able to target similar people and show them your ads.

Behind this simple explanation there is a highly complex algorithm able to locate people with similar interests, demographic, location and professional background.

Facebook and Google are able to do this thanks to the vast amounts of data they have on their users.

Let’s say you track a video as an event. The video is a top-of-the-funnel content that explains the benefits of using the app you are offering. Website visitors who watched the video are ‘recorded’.

You can define the visitors who watched the video as a specific ‘audience’ in Facebook or Google Analytics. 

Then, what the algorithm does is find similarities between the visitors who watched the video and based on these similarities it can show your ads to other people – people who never watched the video – but share the same similarities with your audience.

This is an incredible tool to expand your potential audience and reach people that are likely to be interested in your offering. In marketing jargon, we are talking about high-quality leads in order to get more value on your ad spend.

Connecting the Dots – Events, Audience, and Targeting

So, you might be thinking, this all sounds great. I’m very impressed with both Facebook and Google and how they can help me refine and optimize my ad campaigns – but how do I make all this happen?

You’re right to be asking. Making this ad magic happen requires a lot of setup, tying together the various elements we discussed here – events, audiences and targeting.

Let’s see how it’s done.

The first part of the chain are the events. We’ve already covered how to set them up, both on Facebook and Google Analytics. 

Remember – how you define an event is crucial for the success of the campaign, either retargeting / remarketing or lookalike / similar audience, you’ll run based on this event. 

Once you have the events set up, it’s time to connect them to your ad campaign. In this context, ‘connect’ means enabling Facebook / Google to use the data collected from the event tracking to optimize the ad campaign.

In Facebook

Let’s start with the easier of the two. 

Once you inserted the event tracking code to the various pages of your website, the events data is available for you on your Ads Manager. 

As opposed to Google where you need to first import the event data from Google Analytics to Google Ads (we’ll get to how to do it in a sec) in Facebook this import action is taken care for you.

Still, you’ll need to locate this data. Here’s how:

  • Log in to Ads Manager and click the Pixels tab
  • On the left, choose Data sources, it will take you to your pixel
  • Now you’ll see a general breakdown of your events
  • Events received is the total number of events recorded by the pixel
  • Top events lists the highest performing events
  • Activity shows number of events recorded per day for the past week
  • Click on the Details button

Here you can see the actual breakdown of events, by volume and date. You can segment the visitors based on their actions, as we discussed before, or use the different segmentation for Lookalike audience creation.

Since you are already in Facebook Ads Manager, all the information is available for campaign targeting and optimization.

In Google

It’s a two-step process. First you need to define the events in Google Analytics, and then import them into Google Ads.

  1. Define the event in Google Analytics
  • In your Analytics account, click the Admin tab in the bottom left corner
  • Next, click the Goals tab
  • Select “+New Goal”
  • Choose the “Custom” option
  • Name your goal
  • Select “Event” option

Now you’ll need to refer to the four elements you defined in the event code you had inserted for the specific event. This: onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’, ‘Value’);”

The Goal you’re creating will have a specific box for each value. It looks like this:

The text you are entering here must be identical to the text in the code. If it won’t, the event won’t be recorded.

You’ll need to repeat the process above with every event you’re tracking.

  1. Import the event into Google Ads
  • In your Google Ads account, click the Tools tab at the top navigation bar
  • Select “Conversions” from the dropdown menu
  • On the left side of the page, click “Google Analytics”
  • You’ll see a list of all the goals you defined in Analytics
  • Select the ones you want to import
  • Click “Import”

And… you’re done. 

Yes, the events you track on your website are finally ‘available’ for segmenting your remarketing campaigns and creating similar audiences.

It was a long way to get here, but it is sure worth it.

One more thing though.

Remember way, way back at the beginning of the article when I mentioned Oribi, that tracks all the events on your website automatically without you needing to touch any code?

Well, they also import all these events, to both Facebook Ads Manager and Google Ads, in the same automated, no code way. 


Event tracking provides you with valuable data on your website visitors, such as level of intent, specific interests and place in funnel.

Such valuable data must be collected, since it helps you better understand your audience.

We could have stopped here, as the above present enough value on its own. But there’s more.

This valuable data can also utilized for the optimization of your paid ad campaigns on Facebook and Google.

You can, and should, use event data to deliver highly relevant and effective retargeting / remarketing ads to segmented audiences who have already visited your website.

You should also use event data as the base for creating lookalike / similar audiences for ad campaigns targeting potential audiences who have not yet visited your website. 

By optimizing your paid ad campaigns with event data you’ll be able to better engage users, increase your conversion rate and get more of your ad spend, meaning, you’ll pay less for more clicks.

With all this reasoning, there can be only one conclusion, right?

Right. So go ahead, make my event.

The post How To Use Events To Optimize Your Facebook And Google Ads Campaigns appeared first on Neil Patel.

About us and this blog

We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

Request a free quote

We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

Subscribe to our newsletter!

More from our blog

See all posts
No Comments

Recent Posts

Leave a Comment