Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function boy_add_utm_outbound( $content) {
/* find external links and add the parameters in PHP */
return $content;
}
add_filter( 'the_content', 'boy_add_utm_outbound' );
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !www.yourdomain.com [NC]
RewriteRule ^(.+)$ $1?utm_source=yourbrand [QSA,L]
.each()
across all of the links on a page (and you can force this to only run in your main content <div>
to optimize the search..each()
... (again, untested, just examples)// Cache your parameters
param = ?utm_source=yourbrand&utm_campaign=yourbrand
// Cache the link
var link = $('.main-content a');
// grab the URL
href = link.attr('href');
// strip any existing parameters off
// (watch out for affiliate links, maybe skip any with existing parameters or skip Amazon.com, etc.)
href = href.split('?')[0];
// Append the parameters to the stripped URL
var new_href = href + param;
// Set the new_href into the existing link
link.attr('href', new_href);