How to Customize Sticky Share Buttons (Image, URL, and more)
Looking to customize the title, description, image, or URL that’s displayed when a user shares content on your website? You came to the right place! (If you want to learn how to customize your Inline Share Buttons, go here)
Oftentimes, the Open Graph Protocol tags will populate this information with content from your page but you can tailor it to make it more relevant if it’s not extracting the information you want it to. For example, if a user shares your homepage, you may want to add an image of your product or provide a more compelling description.
Due to the way Sticky Share Buttons are designed (i.e. they don’t need a placement code) you will need to manually add the following code inside the <body> of your site, preferably before the closing of the </body> tag (our script will deal with moving the div where it needs to go):
<div class='sharethis-sticky-share-buttons' ></div>
Properties in <div> tags
Depending on whether you want to simply set a universal URL or shortened URL, add the following tags in the tool placement code <div class=”sharethis-sticky-share-buttons”></div>.
data-network | Specifies to which social platform the content will be shared |
data-url | Specifies URL (can be shortened URL) that you would like shared |
data-short-url | Specifies a shortened URL that can be used in conjunction with the data-url |
data-title | Specifies title that you would like shared (email’s subject in some email channels) |
data-image | Specifies link to image you would like displayed in the shared content |
data-description | Specifies summary text/description you wish to share |
data-username | Specifies your Twitter username |
data-message | Specifies the body copy of e-mail shares |
data-email-subject | Specifies the email’s subject |
Example: This button is set to share the ShareThis home page with the title “Sharing is great!” <div class='sharethis-sticky-share-buttons' data-url="https://sharethis.com" data-title="Sharing is great!"></div>
Notes
- This customization is not available for all social channels. For example, Facebook may always use og: meta tags for the URL instead of these values.
- The data-url attribute will help you set a specific URL (despite which page users are sharing) or add a tracked link.
- Share count may not be recorded since the URL shared is different than the URL the buttons are in.
Order of Precedence
It is important to remember the order of precedence by which the ShareThis code processes share properties. Generally, we recommend using one approach by which sharing properties are specified on your pages to prevent errors.
- Any dynamically specified JavaScript properties (i.e. highest precedence)
- Properties specified in tags (i.e. second precedence)
- Open Graph Protocol tags (i.e. lowest precedence)