Thanks for all the previous answers and solutions. They inspired me to summarize my learnings and solution in this public gist.
I am using Google's global site tag (gtag.js) to track the pageview and successfully attribute it to the Social medium in Google Analytics.
The following snippet illustrates what worked for me. Please note, we use jinja templates (with Nunjucks) to add the necessary and missing data (eg. {{googleAnalytics}}).