Sub topic 1
Start with goals: what counts as a conversion
This chapter sets up the foundation for the rest of the tutorial. You will define what a conversion means for your site, learn how social visitors arrive, tag your links, and install Google Analytics 4 (GA4).
Prerequisites
You should already know:
- Basic HTML and how a page loads scripts
- What a URL and its query string are
- Basic JavaScript syntax
- How to create a post or ad on a social platform
Define your conversion goals
A conversion is an action on your site that has business value, such as a sign-up, a purchase, or a lead form submission. Choose one or two primary conversions before you add any code. For each one, decide the metric that shows whether social media helps, such as sign-ups per 1,000 social sessions or cost per lead from a paid campaign.
How social media visitors reach your site
Visitors arrive from social platforms in several ways. Some clicks carry a referrer, which names the site that sent the visitor. Others come from in-app browsers, or from links shared in messaging apps, where the referrer is missing or hidden. Tagged links, covered next, fix much of this gap.
Tagging links with UTM parameters
A UTM parameter is a label added to the end of a URL, such as utm_source. Analytics reads these labels and groups visits by them. Use the same spelling every time, in lowercase, so reports do not split one channel into several rows.
https://example.com/spring-sale?utm_source=instagram&utm_medium=paid_social&utm_campaign=spring_sale_2026&utm_content=carousel_a| Parameter | Purpose | Example |
|---|---|---|
| utm_source | Where the visit came from | |
| utm_medium | Type of traffic | paid_social |
| utm_campaign | Campaign name | spring_sale_2026 |
| utm_content | Which post or ad variant | carousel_a |
Installing GA4 on your site
Add the GA4 snippet to every page, inside the <head> element. Replace G-XXXXXXXXXX with your own measurement ID from the GA4 admin panel.
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>Exercise
A Facebook ad links to your pricing page. Which parameter should name the ad variant, and why should you keep all values lowercase?
Show answer
Use utmcontent to name the ad variant, for example utmcontent=videob. Lowercase keeps values consistent, so analytics does not show "VideoB" and "video_b" as separate rows.