Skip to content

Share counts

Tracking shares and pageviews in analytics

By Hannah Voss, Editor · Reviewed September 2026 · 5 min read

Quick answer

Share buttons can report a click as an analytics event with the network name and page, which tells you which buttons are used. Traffic that comes back from shares appears in your referrer reports. Be careful with campaign parameters on shared links: they split share counts across URL variants, so add them only where you need campaign attribution.

A single folded graphite paper strip rising in a zigzag line chart across a finely ruled grid

Two different questions

"Which share buttons do readers click?" and "How much traffic do shares bring back?" are separate measurements. The first is an event on your page. The second is visits that arrive from a network. Share plugins sold analytics integrations for the first, including the MashShare Google Analytics add-on and a pageviews add-on that showed views next to shares; both product pages still receive links.

MeasurementWhere it appearsWhat it misses
Share button click eventYour analytics events reportShares made with the browser's own share sheet or by copying the address bar
Referred visitsReferrer or source reportsVisits from apps that send no referrer
Network share countThe counter on the postEverything the network does not report; see the counts guides
Campaign-tagged visitsCampaign reportsOnly links that carried the tag; splits counts

Track button clicks as events

  1. Name the event

    Use one event name such as share with parameters for the network and the page path.

  2. Fire it on click

    Attach a listener to the share links. Send the event, then let the link open as normal.

  3. Include copy link

    Copying the address is often the most used option; track it too.

  4. Check it arrives

    Use your analytics tool's real-time or debug view, then compare a week of clicks by network.

document.querySelectorAll('.share-row a').forEach(function (a) {
  a.addEventListener('click', function () {
    // replace with your analytics tool's event call
    track('share', { network: a.dataset.network, path: location.pathname });
  });
});

Track social shares: Google Analytics event setup

Google Analytics 4 lists share as a recommended event name with the parameters method, content_type and item_id, as of the cited events reference. Using the recommended name and parameters means the event appears in the standard reports without custom definitions. The call below replaces the generic track() line above; the same three values map onto any other analytics tool's custom event.

gtag('event', 'share', {
  method: a.dataset.network,        // facebook, x, linkedin, whatsapp, copy
  content_type: 'article',
  item_id: location.pathname        // /post/
});

In our worked example the figures are invented. One post received 1,000 pageviews in a week. The share events by method were: copy 41, WhatsApp 30, Facebook 23, LinkedIn 12, X 9. Over the same week the referrer report showed 58 visits from facebook.com, 34 from l.facebook.com, 20 from lnkd.in and 11 from t.co, while direct visits rose by roughly 70 above the usual level. The WhatsApp and copy figures, 71 clicks between them, produced no referred visits at all, and they are the probable source of the direct rise.

Read shared traffic

Visits from networks show up in referrer reports as the network's domains, often split between the main site and mobile or link-wrapping domains. Messaging apps frequently pass no referrer at all, so some shared traffic lands in direct. That hidden share is one reason the copy link button matters.

Three views of sharing, from most to least visibleButton click eventswhat readers pressedReferred visitswhat came backDirect visits from chatsoften invisible
Relative visibility, not measured volumes.

Campaign parameters: use sparingly

Adding campaign parameters to every shared link gives tidy attribution but creates a new URL variant per network. Networks count shares per exact URL, so your counts fragment, and cached previews multiply. If you tag shared links, keep the canonical tag pointing at the clean address and accept that counts may split. The arithmetic of that split is worked through in how share counts work.

Privacy-first measurement

Cookieless analytics can still count share clicks and referrers in aggregate, without identifying readers. That is enough to decide which buttons to keep. If your analytics needs cookies, your share tracking inherits the same consent requirements. Neither kind of measurement says anything about who wrote the post that travelled; a spike from a network is a distribution fact, and why a detector score on a short post is not evidence explains why a tool cannot settle that question either.

What goes wrong

  • The event fires, the share does not. A listener that calls preventDefault() and forgets to open the link records a click nobody completed. Send the event and let the browser follow the link.
  • Double counting. The share plugin sends its own event and your listener sends another. Pick one source; check the real-time view for two events per click.
  • Counting a click as a share. A click opens the network's dialog; the reader may cancel. Treat click events as intent, and the referrer report as the outcome.
  • Campaign tags on every button. Counts fragment across five URL variants and the network's sharing debugger caches five previews. Tag newsletters and campaigns, and leave the on-page buttons clean.
  • Reading direct as no shares. Messaging apps rarely pass a referrer, so a post that travelled well in chats looks unshared in the referrer report and busy in direct.

Check it worked

  • Click each share button once on a test post and see one share event per click in the real-time or debug view, with the expected method value.
  • Confirm the network's share dialog still opened for each click.
  • After a week, compare share events by method with referred visits by network; the ranking should be roughly similar for networks that pass a referrer.
  • Check that the copy button is counted and that its method value is distinct.
  • If you added campaign tags anywhere, confirm the canonical tag still points at the clean address and that the counter on a post whose share count is not updating is not simply split across variants.

More on this topic sits in the share counts section: start with Facebook share count: getting it from the Graph API, then how to create a Facebook access token.

Sources

Questions

How do I see which share buttons people use?

Send an analytics event on each share click with the network name, then compare totals by network.

Why does shared traffic show up as direct?

Many messaging apps pass no referrer, so visits from shared links in chats look like direct traffic.

Should I add UTM tags to share links?

Only if you need campaign attribution. Tags create URL variants that split share counts.

What is the recommended share event in Google Analytics 4?

The event name share with the parameters method, content_type and item_id, as listed on the cited recommended events page. Using those names means the event shows in standard reports without custom definitions.

Can I track share clicks without cookies?

Yes. A click event carries the method and the page path, which is aggregate data with no identifier. Cookieless analytics tools record it, and the referrer report works the same way.

Share this guide

Hannah Voss, Editor. Checks every guide against a working WordPress install and the networks' current documentation. Last reviewed September 2026.

  1. Which share networks to show, and how manyHow to choose which social share buttons to display: match networks to your audience, keep the row short, and add copy link, email and messaging options.6 min read
  2. How share counts work, and why most networks stoppedHow Facebook and other networks calculate share counts, why X, LinkedIn and others removed them, what a share counter really shows, and how plugins fetch it.6 min read
  3. Share buttons and GDPR: what needs consentWhich share buttons need consent under GDPR and ePrivacy rules, why plain share links usually do not, the two-click pattern, and privacy policy wording.6 min read