GA Link Tracking Shortcode
GA Link Tracking Shortcode
// Add Shortcode function track_link_shortcode( $atts , $content = null ) { // Attributes extract( shortcode_atts( array( 'url' => 'http://', 'campaign' => 'YOUR CAMPAIGN NAME', 'target' => '_blank', ), $atts ) ); // Code return '<a href="' . $url . '" campaign="' . $campaign . '" target="' . $target. '" class="clickTracking">' . $content . '</a>'; } add_shortcode( 'track-link', 'track_link_shortcode' );