Custom share button code for social media



Want to share your blog content on Facebook, Twitter and LinkedIn? Do multi-option social media sharing tools like ShareThis seem overkill? This is where share buttons can come in. Share buttons are a simple and effective resource for increasing website views and boosting engagement. Facebook, Twitter, and LinkedIn all offer options for sharing content. Share buttons can appear anywhere on a website, including product pages, blogs, and checkout pages. However, in order to add them to your website, you need to know the code required to create them.

What are share buttons?

A share button is an option used to display content on social networks. Consumers share their purchases with others online and potentially provide you with new insights. Share buttons also help users save the products and services that interest them. Later, the target returns to their social media pages to access the product link and close the sale.

Share buttons are beneficial for any type of online content. Blogs often include a share button at the top and bottom of a post to increase visibility. While blogs normally have a share button, you can include a share button on any landing page on your website. [Read related article: How to Measure and Analyze Your Content Performance]

Advice: While many businesses use social media share buttons to encourage customers to share their purchases, you can also use them to encourage customers to share your blogs.

Share buttons are free to install and available for integration on any social media. Twitter, Facebook, Instagram, and other sites have share buttons that can be inserted into any online content. The share button is also usually customizable to help build brand awareness once the content is shared. For example, hashtags must be added to make shared content searchable.

To get the most out of the benefits, businesses should consider the ideal time for share buttons. For example, you might want a share button at the end of a purchase, but you don’t want to distract the user from completing the checkout process. Share buttons can be minimized so as not to distract the user’s attention from the product or service.

Types of share buttons

Social media share buttons fall into two categories: persistent and online buttons. Both options can be used on popular social media platforms, like Facebook, Twitter, and LinkedIn.

Sticky buttons These buttons appear on the left or right side of the user’s screen as they scroll through your blog or other web pages. They don’t go away when you scroll the article up or down, which is why they are called “sticky”.
Online Buttons These buttons appear in a row on a single line in your blog or webpage copy. Once you get past them, they don’t stay on the page. Of course, you can go back to have them reappear.

Final resultAt the end of the line : Sticky buttons stay on the side of your web pages as customers scroll, while inline buttons disappear and reappear as you scroll.

How to add a share button on a website?

Each social network site offers different options for share buttons. That said, the steps below for adding a share button to your website are pretty much the same for each social media platform.

  1. Visit each site and log into your account to access all options.
  2. Consider personalization when creating a share button for your website. For example, Twitter allows you to add a mention or a hashtag when any of your content is shared. Facebook offers the possibility for the user to add their own message when sharing your content on their profile pages.
  3. In addition to the share buttons, each social network site gives you access to buttons that perform specific actions. For example, Facebook not only allows you to share content, but also offers a Like button. The Like button can be used as a link to your business Facebook page.
  4. Once you have customized the share button, grab the required HTML code.
  5. Paste the HTML code into your website, wherever you prefer.
  6. To see if your share buttons are having the desired impact, you should A / B test them. This is recommended as a way to confirm the best location for share buttons on your website. With A / B testing, you create two different sets of websites. You can compare the sizes of the share buttons as well as the ideal locations on the page. Through testing, you can see which version is most likely to generate conversions.

    for your informationFOR YOUR INFORMATION: A / B testing shows you what two different share button locations will look like on your website and indicates which location is most likely to elicit the desired customer action.

  7. Check the links often once they’re online to make sure they’re up and running. Also remove any type of counters that appear with social media buttons. A low meter can discourage users from finalizing sales.

To automatically add custom share buttons to every post in a WordPress blog, add the following code to the single PHP file, which renders the individual post. (You must use, the self-hosted version of WordPress, to customize PHP files.)

Facebook share button code

function fbs_click() {u=location.href;t=document.title;''+encodeURIComponent(u)+'&t='+encodeURIComponent


Comments are closed.