tabalinas / jssocials

Social Network Sharing jQuery Plugin
http://js-socials.com
MIT License
464 stars 104 forks source link

jssocials counter counts separately for logged users and guests #219

Open OksanaRozsokha opened 5 years ago

OksanaRozsokha commented 5 years ago

Hi. Thank you for great plugin! I use jssocials to share posts on my website. It was so nice with that. But when I had to add the counter for shares I am having some problems. When i share a post as a logged user in our system, the counter works fine(it shows number 1 as expected). But when I log out and go to this post, the counter does not show the number of shares and when I share this post again it also shows number 1. It looks like it counts separately for logged users and guests. Now i can see only the number of the shares of all logged users if I logged too. And when I log out I can see only the number of the shares of all non-logged users.

I`m not sure, but maybe the reason for that is difference in url parameter. In our system, referral is added to the url for logged users.

For example, the urls looks like: https://www.example.com - for non-logged users https://www.google.com?ref=id - for logged users

Maybe plugin detects these urls as different? Is there a way to share a page with a dynamic url or Is there any other way to solve this problem?

I tried to add a referral with id=0 (https://www.google.com?ref=0) for non-loged users but it didn`t help.

Here is my code: $(document).ready(function(){ $('#share-page').jsSocials({ showLabel: false, showCount: "inside", shareIn: "popup", url: "#{target_url + person_referral_code.to_s}", shares: [ { share: "facebook", label: "Share" }, "twitter", "linkedin", { share: "email", label: "Email" }, { share: "googleplus", label: "Share" } ] }); });