URL parameters | WordPress.org

[ad_1]

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 );

}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer