URL Cleaning

Last Updated: Sep 11, 2013 02:58PM EDT

Most of the time, you just want AddThis to simply share the URL provided. Sometimes, however, you might want to add remove irrelevant parameters (like session IDs or campaign tracking codes).

For a comprehensive discussion of all the ways AddThis can modify your URL at share time, see the URL Transforms section of our Client API.



Removing Google Analytics parameters

If you're a heavy user of Google Analytics, your URLs might be cluttered with Google parameters like utm_source, utm_campaign, etc. By default, we share these parameters as if they were a significant part of your URL. This has two drawbacks: third-party analytics engines (and shorteners like bit.ly) will interpret differently-parameterized URLs as unique, and, worse, users following shared links will have incorrect campaign information attached to their session.

Because Google campaign tracking is so commonly used, it’s included in our default URL cleaner. Just turn on URL cleaning to strip all GA parameters:

var addthis_share = {
     url_transforms : {
         clean: true
     } 
} 



Removing arbitrary parameters

Have another custom parameter you'd like to remove? Just specify it like so:

var addthis_share = {
     url_transforms : {
         clean: true,
         remove: ['my_custom_parameter', 'another_custom_parameter']
     } 
} 

Still need help?


General Topics

 

Developers