Skip to content
Home » Documentation » Socialized » Using Socialized with Google Tag Manager

Using Socialized with Google Tag Manager

    Time needed: 5 minutes

    Tracking user clicks on the socialized share buttons is easy with Google Tag Manager (GTM), all you need is a variable, trigger, and a tag.

    1. Create the custom variable

      Create a new variable called “Social Sharing Platform” with the variable type Data Layer Variable

      Set the “Data Layer Variable Name” to gtm.element.dataset.platform

      Optionally, you can check the box to “Set Default Value” and leave it blank.

      Save the variable.

    2. Create the Trigger

      Create a new trigger named “Share on Social Media” with the trigger type Click - Just Links

      Check the radio button for “Some Link Clicks” and choose Click Classes contains socialized-link

      Save the trigger.

    3. Create the Google Analytics 4 Tag

      Create a new tag named “Share on Social Media” with the tag type “Google Analytics: GA4 Event”

      Set the “Event Name” to share

      Create a new row under “Event Parameters” with the “Parameter Name” set to social_media_platform and the “Value” set to {{Social Sharing Platform}}

      Add your website’s configuration tag.

      Set the firing triggers to the “Share on Social Media” trigger you made in step 2.

      Save the tag.

    4. Test & Publish

      Preview your updates in GTM. With the GTM debugger, click on any of the sharing icons and check that your new tag fired when clicked.