If you are using Sassy Social Share, Super Socializer or Sassy Social Share Premium plugin for Social Share, follow the steps mentioned below to track Social Share with Google Tag Manager.
- If using Sassy Social Share or Super Socializer, download, install and activate Social Sharing Analytics add-on or if using Sassy Social Share Premium, navigate to Sassy Social Share Premium > Social Analytics Sharing options page from left sidebar in admin area.
- Choose “Yes, I am using Google Tag Manager” in “Already using Google Analytics” option at add-on options page in admin area and save changes.
- Navigate to https://tagmanager.google.com and login to your account, if not already logged in.
- Select the container you are using for your website, by clicking on the container name (We are assuming that you have already created a container to enable Google Analytics at your website).
- Click Variables in the left sidebar
- Click Configure button in the right side, scroll down and tick mark all the checkboxes in Clicks section. Close this section
- Click New button in the User-Defined Variables section
- Name this variable Social Network. Click “Choose a variable….” to configure it.
- Select Custom Javascript in Choose variable type section. Click Continue button.
- If using Super Socializer, Sassy Social Share, Sassy Social Share Premium or Sassy Social Share Pro, place following Javascript in Custom Javascript option and click Save button:
function(){ var p = {{Click Element}}; if(p.hasAttribute('title')){ return p.getAttribute('title'); } do{ var o = p; p = o.parentNode; } while(!p.hasAttribute('title')); return p.getAttribute('title'); }
- Create another variable as done in step 7 and name it Social Target. Select Custom Javascript in Choose Type option. Place following Javascript in Custom Javascript option:
If using Sassy Social Share plugin:function(){ var p = {{Click Element}}.parentNode; do{ var o = p; p = o.parentNode; } while(!p.classList.contains('heateor_sss_sharing_container')); return p.getAttribute('data-heateor-sss-href'); }
If using Super Socializer plugin:
function(){ var p = {{Click Element}}.parentNode; do{ var o = p; p = o.parentNode; } while(!p.classList.contains('the_champ_sharing_container')); return p.getAttribute('data-super-socializer-href'); }
If using Sassy Social Share Pro or Sassy Social Share Premium plugin:
function(){ var p = {{Click Element}}.parentNode; do{ var o = p; p = o.parentNode; } while(!p.classList.contains('heateor_sssp_sharing_container')); return p.getAttribute('data-heateor-sssp-href'); }
- Click Triggers in left sidebar. Add a new trigger by clicking on New button. You can name it something like “Sassy Social Share” or “Super Socializer Share” depending on the plugin you are using.
Click “Choose a trigger type to begin setup”.
Choose All elements - Configure the trigger as shown in the screenshot below. Enter “heateor_sss_” (if using Sassy Social Share), “heateor_sssp_” (if using Sassy Social Share Pro, Sassy Social Share Premium) OR “the_champ_“ (if using Super Socializer) in “Starts with” option. Click Save button
- Click on Tags in the left sidebar.
- Create a new tag by clicking the New button (we are assuming that you have already created Google Analytics tag)
- Name it Sassy Social Share, Sassy Social Share Pro/Premium or Super Socializer. You are free to give it any name. Click on “Choose a tag….” to configure it.
- Choose Google Analytics: GA4 Event
- Select the Configuration tag that you have already created for Google Analytics OR if you have not created any such tag, you can choose None – Manually Set ID and specify the Measurement ID associated to the Google Analytics property that you will use to track the social shares
- Type share in the Event name option. Click Event Parameters section. Add a row with Network as Parameter Name and click (+) icon to select {{Social Network}} in the Value option. Add another row with Target URL as Parameter Name and click (+) icon to select {{Social Target}} in the Value option
- Click “Choose a trigger….” section
- Select the trigger you created in step 11 above (we named it Sassy Social Share) and click Save button.
- Create Tag by clicking the Save button
- Click Submit button in top-right corner
- Click Publish button. Your changes are live now.
- You can see the shares being tracked in the Reports > Engagement > Events section in your Google Analytics dashboard after 24 hours (minimum) after making above changes