• Resolved theglobe001

    (@theglobe001)


    I have a function (added to my functions.php) I was using for the Jetpack (ShareDaddy) social share buttons, and it was passing UTMs parameters to my Google Analytics. I can’t make it work using the Shared Counts. I am not sure what I am doing wrong here:

    add_filter( ‘sharing_permalink’, ‘social_share_link_utm’, 10, 3 );

    function social_share_link_utm( $permalink, $post_id, $sharing_id ) {

    $ga_params = array(

    ‘utm_source’ => $sharing_id,

    ‘utm_medium’ => ‘Social’,

    ‘utm_campaign’ => ‘SBar’,

    );

    return add_query_arg( $ga_params, $permalink );

    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    The Shared Counts plugin does not include a filter called sharing_permalink so the code you’ve shared wouldn’t run.

    You can use the shared_counts_link filter to customize the Shared Counts like. Note that it’s an array of settings, not a string, so you’ll want to customize $link['link'].

    Here are a few tutorial showing you how to use the filter: https://sharedcountsplugin.com/sc_filter/shared_counts_link/

    If you’re using the standard Google Analytics JS ( ga ) or Monster Insights (__gaTracker), the plugin is already tracking your social share data in Google Analytics. Here’s the code.]

    This uses Google Analytics’ social tracking feature, not UTM data.

    Thread Starter theglobe001

    (@theglobe001)

    Very helpful Bill. Thank you very much for the quick response. It worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘URL parameters’ is closed to new replies.