No commit activity in last 3 years
No release in over 3 years
Share on social media platform and check how many times url was shared in social networks, e.g. share counts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0
~> 10.0

Runtime

 Project Readme

SocialShareFeature

This is a gem to help you quick create a share feature and social share counts in you Rails application.

Installation

Add this line to your application's Gemfile:

gem 'SocialShareFeature'

And then execute:

$ bundle

Or install it yourself as:

$ gem install SocialShareFeature

Configuration

Add this line to your application's initializers file.

require 'SocialShareFeature'

For Facebook share count we need to initialize the facebook token which we can get from https://developers.facebook.com/ and create your own app and go to https://developers.facebook.com/apps/YOURAPPID/settings/basic/ And copy YOUR App ID and App Secret

EX: YOURAPPID = "2254794191441963"

Add this line to initilizers file:

	SocialShareFeature.facebook_token_for_count= "Your App ID|Your App Secret"
where **This is only Example use your own details**
Your App ID = "2254794191441963"
Your App Secret = "247c3641f30468d363bf8a827d6e673a"

If you want multiple socal share links at a same time Then you can use this Define This in initilizers file to set default social platform:

SocialShareFeature.allow_sites_for_share_button =  %w(twitter facebook weibo)

Usage

Get The Count of Social Share

 social_count = SocialShareFeature::Count.selected "https://www.google.com/", %w(facebook reddit)

OR you can use like this

 SocialShare::Count.facebook "https://www.google.com/"

Get The List of Supported Network For Count:

SocialShareFeature::Count.supported_networks
 => [:facebook, :google, :reddit, :weibo] 

To Use Social Share Button you required

Get The List of Supported Network For Share Button:

SocialShareFeature::Button.supported_networks
 => [:facebook, :google, :linkedin, :pinterest, :reddit, :twitter, :weibo] 

You need add require js file in your app assets files and add Jquery in your Project:

app/assets/javascripts/application.js

//= require share_button
// if you need use WeChat
//= require share_button/wechat 
_OR_

For app/assets/javascripts/application.coffe

#= require share_button
# if you need use WeChat
#= require share_button/wechat 

app/assets/stylesheets/application.css

*= require share_button
**OR**

For app/assets/stylesheets/application.scss In Rails 4.1.6 , use @import to require files:

@import "share_button";

Add Button With Image to view

     <%= social_share_button_tag('',:allow_sites => 'facebook',img: {src: 'http://Default Image Url.com/',class: 'class for default image'}, :url => "https://my shatring url/", :image => "https://my image url.com/", desc: 'The summary of page',class: 'my class to btn') %>

Add a link Without image to view

      <%= social_share_button_tag('Facebook',:allow_sites => 'facebook', :url => "https://my shatring url/", :image => "https://my image url.com/", desc: 'The summary of page',class: 'my class to btn') %>

Add Link to the view for default social media platform defined in your initilizer.

     <%= social_share_button_tag('',:url => "https://my shatring url/", :image => "https://my image url.com/", desc: 'The summary of page',class: 'my class to btn') %>

Gem Link

Ruby Gems: rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Avdhesh51000/SocialShareFeature. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the SocialShareFeature project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.