Lesson 3 of 7
Share Event
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
GA4 publishes a list of recommended events, names like share, login and search with defined parameters. Use the recommended name and GA4 lights up reports built for it; invent your own and you get a custom event with none of that polish. So when it fits, match the convention.
share expects a method (where it was shared) and a content_type (what was shared). The buttons below push exactly that. Your job is the Custom Event trigger plus a GA4 Event tag that forwards those parameters, the same event-to-tag pattern, now with parameters that mean something to GA4.
Goal
Fire the GA4 recommended share event with method and content_type when a visitor shares.
Build it in GTM
See what the page pushes
Each network button pushes{ event: "share", method: "x", content_type: "article", item_id: "post_42" }. Those keys are the GA4-recommended parameters forshare.Custom Event trigger on share
Triggers → New → Custom Event, event nameshare.Send a GA4 Event tag named share
Create a GA4 Event tag, Event Nameshare, firing on that trigger. (TheCustom HTML - Teststand-in also satisfies the check if you haven't set up GA4 yet.)Map the parameters
In the tag's Event Parameters, addmethodandcontent_type, reading them from Data Layer Variables of the same name. GA4 now receives a fully-formed recommended event.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
share event fires with method set to that network and content_type = article. In Tag Assistant your GA4 tag fires and the parameters appear on the outgoing hit.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded