Julienh / Sharrre

Make your sharing widget! Sharrre is a jQuery plugin that allows you to create nice widgets sharing for Facebook, Twitter, Google Plus (with PHP script) and more.

Home Page:sharrre.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Counter Conflicts

LockeAG opened this issue · comments

Hi , Guys , thank you , for continuing the project. It is without a doubt a great piece of code.

One of the main problem is the lack of tracking on Universal Analytics Code. I think updating this is a Must , I just saw that there is a pull request that updates this (#248) , I test out, and it is not working well. I hope this will improve with time.

Second , when I update to version 2.0.0 , all my counters reset. Is there any way to recover the count??

let me show my sample code .:

/**
 * Share Script
 */
 function shareme(shareElement, shareElementMobile) {

    $(shareElement).each(function(i) {
        $(this).sharrre({
            share: {
                facebook: true,
                twitter: true,
                pinterest: true,
                linkedin: true,
                tumblr: true,
            },
            template: '<ul class="box"><li> <h2>{total}<small>Compartido</small> </h2> </li><li id="facebook"><i class="fa fa-facebook"></i></li><li id="twitter"><i class="fa fa-twitter"></i></li><li id="googleplus"><i class="fa fa-google-plus"></i></li><li id="linkedin"><i class="fa fa-linkedin"></i></li><li id="pinterest"><i class="fa fa-pinterest"></i></li><li id="tumblr"><i class="fa fa-tumblr"></i></li></ul></li></ul>',
            enableHover: false,
            enableTracking: false,
            buttons: {
                googlePlus: {},
                facebook: {
                    layout: 'button',
                    send: true
                },
                twitter: {
                    via: 'LockeAG',
                },
                linkedin: {},
                pinterest: {}
            },
            url: 'http://code.google.com',
            render: function(api, options) {
                $(api.element).on('click', '#twitter', function() {
                    api.openPopup('twitter');
                    return false;

                });
                $(api.element).on('click', '#facebook', function() {
                    api.openPopup('facebook');
                    return false;

                });
                $(api.element).on('click', '#googleplus', function() {
                    api.openPopup('googlePlus');
                    return false;

                });

                $(api.element).on('click', '#pinterest', function() {
                    api.openPopup('pinterest');
                    return false;

                });


                $(api.element).on('click', '#linkedin', function() {
                    api.openPopup('linkedin');
                    return false;
                });

                $(api.element).on('click', '#tumblr', function() {
                    api.openPopup('tumblr');
                    return false;

                });
            }
        });


    });

    $(shareElementMobile).each(function(i) {
        var lnk = $(this).attr('data-url'),
        txt = $(this).attr('data-text'),
        resTxt = encodeURIComponent(txt),
        resLnk = encodeURIComponent(lnk);


        $(this).sharrre({
            share: {
                facebook: true,
                twitter: true,
                linkedin: true
            },
            template: '<ul class="box"> <li> <h2>{total}<small>Compartido</small> </h2> </li><li id="facebook"><i class="fa fa-facebook"></i></li><li id="twitter"><i class="fa fa-twitter"></i></li><li id="linkedin"><i class="fa fa-linkedin"></i></li><li id="whatsapp"><a href="whatsapp://send?text=' + resTxt + ' ' + resLnk + '" data-action="share/whatsapp/share"><i class="fa fa-whatsapp"></i></a></li></ul>',
            enableHover: false,
            enableTracking: false,
            buttons: {
                facebook: {
                    layout: 'button',
                    send: true
                },
                twitter: {},
                linkedin: {}
            },
            render: function(api, options) {

                $(api.element).on('click', '#twitter', function() {
                    api.openPopup('twitter');
                    return false;
                });

                $(api.element).on('click', '#facebook', function() {
                    api.openPopup('facebook');
                    return false;
                });

                $(api.element).on('click', '#linkedin', function() {
                    api.openPopup('linkedin');
                    return false;
                });

                $(api.element).on('click', '#whatsapp', function() {
                    api.openPopup('whatsapp');
                    return false;
                });

            }
        });


    });
}

Thank you!

I'll look into it today, you shouldn't lose counts.

Thank you! ,

Is there any co-relation between wildcards and the counter? ,what I mean is that www.domain.com can be affected if you change it to http://domain.com.

thank you

Yes, the way most API works relies completely on your domain, even if you went from http to https you can lose counts. The best way to avoid this problem is to set a standard url in the url parameter of Sharrre.