Google Analytics Social Interactions via. gtag.js

304 Views Asked by At

Google Analytics documentation seems light on this topic, but historically businesses have been able to track social sharing interactions on their websites - 'Social Plugins' - via. both ga.js and analytics.js. See here: https://support.google.com/analytics/answer/1316556?hl=en

For use case example, as a business, an analyst would like to understand how often website content is shared onto social networks by website visitors.

The problem I'm having is, I can't easily find what the gtag.js equivalent is of this functionality. The closest I can find is to send a gtag event called 'share' - but not sure if this will populate the Social Report under Acquisition in Google Analytics.

Could anyone please advise how to track Social Interactions via. gtag.js for Google Analytics?

//ga.js
_gaq.push(['_trackSocial', network, socialAction, opt_target, opt_pagePath]);
> https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial

//analytics.js
ga('send', 'social', [socialNetwork], [socialAction], [socialTarget], [fieldsObject]);
> https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions

Note: I found this website which website - https://www.balkanweb.com/peshq-te-barabarte-pavaresisht-nga-madhesia/ - which does seem to use gtag event 'share' function but I am just not sure if it populates the Social reports in GA as I can't see any documentation to support that.

gtag('event','share',{method:'twitter',event_action:'tweet',content_id:targetUrl})
2

There are 2 best solutions below

3
Michele Pisani On

I made a test and I confirm that the share event mentioned does not end up in the social report but in the event report.

Since the gtag.js documentation does not mention social hits (the parameter can only be: CONFIG, SET or EVENT) I believe there is currently no way to send that type of interactions from the website with gtag.

0
Michael D. On

Sadly there is no way to translate this social hit type from UA (Universal Analytics) to GA4 (Google Analytics 4) directly.

The Universal Analytics to Google Analytics 4 migration guide (by Google) mentions this in the Hit types section of the document comparing the two:

Universal Analytics hit types include page hits, event hits, ecommerce hits, and social interaction hits.

In contrast, Google Analytics 4 data is event-based, with the principle that any interaction can be captured as an event. As such, Universal Analytics property hit types translate to events in a Google Analytics 4 property.

Further down the document it also says:

[...] it’s better to rethink your data collection in terms of the Google Analytics 4 model rather than port your existing event structure to Google Analytics 4.