AddThis Academy

An ever-growing library of resources to help you become a better online marketer.

Adding Parameters to URLs

It’s easy to add arbitrary parameters to your URLs at share time.

var addthis_share = {
     url_transforms : {
         add: {
             my_favorite_number: '6',
             my_name: 'matt'
         }
     } 
} 

Using this example, the URL http://example.com would become:

http://example.com?my_favorite_number=6&my_name=matt

We’ll also template the special strings {{code}}, {{url}}, and {{title}} with the service code being shared to, the url being shared, and the title of the page being shared, respectively. So if you wanted to log the referring service using your own system, you might define the following transform:

var addthis_share = {
     url_transforms : {
         add: {
             referring_service : '{{code}}'
         }
     } 
} 

Using this example, when sharing, e.g., to Google, http://example.com would become:

http://example.com?referring_service=google

Allowing you to easily track where your referred users were coming from.

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.

Adding Parameters to URLs
5 (100%) 1 vote

Was this article helpful to you?