DM5: Tracking: events, tags and measurement plans

Lesson 1 of 5 · reading 15–25 minutes; practice and project time is on the module page

How tracking works

🎯You'll be able to

Explain page tags, pixels, cookies, local storage and client IDs, and the difference between first-party and third-party tracking.

🏠The everyday picture

A museum gives each visitor a numbered sticker at the door. Guards note "sticker 482 entered the textiles room" without knowing the visitor's name. At the end of the day the museum knows which rooms are popular and where people turned back.

📘What it really is

📝A worked example

Input: MittiMart's solved tags.js sends this when a product page loads:

{"event": "view_item", "params": {"currency": "INR", "value": 480,
 "items": [{"item_id": "kulhad-set", "item_name": "Kulhad set of 6", "price": 480, "quantity": 1}]},
 "client_id": "c8k2x1q9m3", "ts": 1793616000000}

Steps:

  1. Name the parts: event name, parameters, client ID, time.
  2. Check for personal data: none (no name, email or phone).
  3. Check the types: value and price are numbers.

Expected output: an event an analyst can count by product and sum by value, linked to a browser but not to a named person.

🌍Where it's used

📝Case scenario

A shop's analytics showed only 40% of its orders. The tag fired on the thank-you page, but many customers paid through a UPI app and closed the browser before returning to it. The team added a server-side purchase record for reconciliation, and learned to treat analytics purchase counts as a sample.

🖱️Try it

Run npm run serve in the solved state of your Project 1 (or watch the starter), browse MittiMart and read the collect: lines in the terminal. Success: you can name the event and two parameters in one line.

⚠️Common mistakes

🛠️For your project

Project 1 works on site/js/tags.js (how events are sent) and site/js/shop.js (which events and parameters).

✅Quick check

What does a client ID do?

Show the answer

It links events from the same browser over time, without being a name.

Why are third-party cookies less useful than they were?

Show the answer

Browsers increasingly block them, so tools rely more on first-party data.

← BackDM5
ProLearners Assist