Skip to main content

For AI agents: a Markdown version of this page is at https://docs.snowplow.io/docs/sources/web-trackers/tracking-events/social-media.md. The index of all documentation pages is at https://docs.snowplow.io/llms.txt, and the index for this section is at https://docs.snowplow.io/docs/cdi/llms.txt.

Track social media interactions with the web trackers

Social interaction tracking is provided as part of the Site tracking plugin. This plugin also provides events for site search and timings.

Social media interaction events must be manually tracked.

Install plugin​

Tracker DistributionIncluded
sp.js✅
sp.lite.js❌

Download:

Download from GitHub Releases (Recommended)Github Releases (plugins.umd.zip)
Available on jsDelivrjsDelivr
Available on unpkgunpkg

Note: The links to the CDNs above are pinned to a specific version at the time of writing. Check the plugin's GitHub releases for newer versions, and update the pinned version when you upgrade.

javascript
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-site-tracking@4.10.2/dist/index.umd.min.js",
["snowplowSiteTracking", "SiteTrackingPlugin"]
);

Event​

Social tracking is used to track the way users interact with Facebook, Twitter and Google + widgets, e.g. to capture "like this" or "tweet this" events.

The trackSocialInteraction method takes three parameters:

ParameterDescriptionRequired?Example value
actionSocial action performedYes'like', 'retweet'
networkSocial networkYes'facebook', 'twitter'
targetObject social action is performed on e.g. page ID, product IDNo'19.99'

The method is executed in as:

javascript
snowplow('trackSocialInteraction', {
action: string,
network: string,
target: string
});

For example:

javascript
snowplow('trackSocialInteraction', {
action: 'like',
network: 'facebook',
target: 'pbz00123'
});

Was this page helpful?