How Facebook and Google Track Your Online Behavior

Facebook and Google are the two most popular websites in the world for news sites, marketers, and everyone else in the business of trying to get folks to consume content or make purchases online. If you read a news article today, chances are one of these two sites played a role in it ending up in front of your eyes. According to Parse.ly, nearly 80% of external referral traffic to digital publishers in the past 12 months has come from Facebook or Google.

Image for post
Image for post
There’s Google and Facebook, then there’s everybody else

So, what do Facebook and Google get out of this? Data. Specifically, your data. When you click a link on Facebook or search for a product on Google, these sites analyze your behavior — even after you’ve left those sites and are several clicks along on your Internet journey. This information is then a valuable commodity for marketers looking to get their content or products in front of people who are more likely to be interested. As someone who used to manage Audience Development and Social Media for digital publishers and is now a software engineer, I thought it would be interesting to look at the software that allows Facebook and Google so much access into your browsing behavior.

Facebook Pixel

One of the most widely used features Facebook offers to monitor this online behavior is the Facebook Pixel. The Facebook Pixel is a short Javascript script that sits between the <head> tags on every page of a website. Here’s what it looks like:

Image for post
Image for post
A screenshot of the Facebook Pixel in the Chrome developer

This script monitors user behavior, and allows marketers to track user behavior across devices and see how users continue to interact with a given website even after leaving Facebook. Here’s an example of how this works: If I click on 10 articles about the Boston Celtics, the Facebook Pixel will track that behavior and recognize that as a pattern. Then, if ESPN has a big feature on Kyrie Irving they want to promote on Facebook, and they want to target users interested in the Boston Celtics, Facebook will place me in that interest group based on my activity and I’ll be shown the article in my News Feed. Marketers can also create custom audiences when targeting Facebook ads based on the data collected from the Facebook Pixel.

If you’re curious how Facebook is categorizing you to advertisers, here’s how you can find out:

  1. Click the drop-down menu on the top-right of Facebook
  2. Select ‘Settings’
  3. Click ‘Ads’ in the left-hand menu
  4. Click ‘Your Interests’ and prepare to be freaked out / confused
Image for post
Image for post
I’ve never seen ‘Roseanne’ 🤔

Google Analytics

Not to be outdone by their rival, Google also offers one of the most robust tools for digital marketers: Google Analytics. Google Analytics is the industry standard for monitoring audiences and seeing where and how your site is getting traffic. In addition to its basic built-in recognition of referral sources (Search vs. Social vs. Direct), it enables you to place custom URL parameters on links based on where a user is clicking on it. That’s why so often, when you click an article that looks like this:

Image for post
Image for post
Dogs!

You’ll end up with this URL, where the highlighted section is all you need to actually reach the page.

https://deadspin.com/dogs-1832586178?utm_medium=socialflow&utm_campaign=socialflow_deadspin_facebook&utm_source=deadspin_facebook&fbclid=IwAR0Y37dI-qBoXx2_UjvFZ_US2mWTH6Ncjej5as8y0BqtqBrVTEsBHG6bSp0

This allows web sites to more accurately see how much traffic they’re getting from various sources (their own Facebook page, partner referral programs, newsletters, etc.) and adjust their approaches / resources accordingly.

Conclusion

If you’re a developer working for a company monitoring traffic and/or online sales, you will no doubt need to work with the Facebook Pixel and Google Analytics, so it’s good to be familiar with how they work and where they fit in to your website.

For everyone else, it’s good to be aware of this technology and the many near-invisible ways Facebook and Google keep tabs on you while you browse the web.

Written by

Full-Stack Web Developer. Studied at @FlatironSchool

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store