Social Buttons - Shows Link when # used in url

Discussion in 'Products & Tools' started by BamaStangGuy, Feb 7, 2014.

  1. BamaStangGuy

    BamaStangGuy Notable Member

    Messages:
    955
    Likes Received:
    51
    Best Answers:
    1
    Trophy Points:
    245
    #2
    Also, another question: I assume this works fine with tracking social events using your Google Analytics xenForo add-on correct?
     
    BamaStangGuy, Feb 7, 2014 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    I see what was going on with the hash... on our end we were checking to make sure it's a well-formed URL and wasn't taking into account hashes being passed in. It should work now (refresh the page).

    As far as the Analytics, no... the thing from Better Analytics keys on DOM objects from the traditional buttons.

    This is the JS I'm using here currently to do it... although I was thinking about maybe just making it built into the social plug-in, but right now it's not there... Just trying to decide if it's worth it since not everyone uses Analytics.
    $('.dp-twitter').on('click', function(e) {
        _gaq.push(['_trackSocial', 'Twitter', 'Tweet', window.location.href]);
    });
    
    $('.dp-fb').on('click', function(e) {
        _gaq.push(['_trackSocial', 'Facebook', 'Share', window.location.href]);
    });
    Code (javascript):
     
    digitalpoint, Feb 7, 2014 IP
  3. BamaStangGuy

    BamaStangGuy Notable Member

    Messages:
    955
    Likes Received:
    51
    Best Answers:
    1
    Trophy Points:
    245
    #4
    Not everyone uses analytics but I bet the percentage is pretty high? Either way, I'll probably use this regardless. Looks nice. Hash works now as well.
     
    BamaStangGuy, Feb 7, 2014 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    Don't worry about the extra code... I just went ahead and made the Analytics tracking built into the social buttons thing itself (it will track if it's installed on any site if it has Analytics running). It just checks if the Google Analytics JavaScript object is defined or not (that way it's not trying to track if they don't have Analytics).

    BTW - 44.19% of sites run Google Analytics. :)

    https://tools.digitalpoint.com/cookie-search
     
    digitalpoint, Feb 7, 2014 IP
    BamaStangGuy likes this.
  5. BamaStangGuy

    BamaStangGuy Notable Member

    Messages:
    955
    Likes Received:
    51
    Best Answers:
    1
    Trophy Points:
    245
    #6
    I bet that percentage is much higher for people that download Social Tools though :) Thanks for the quick response and help.
     
    BamaStangGuy, Feb 7, 2014 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    Probably... but still never going to be 100%. Just didn't want it to throw JS errors when trying to interact with a nonexistent Google Analytics object. Not sure why I didn't think to just check if the object exists or not before. haha
     
    digitalpoint, Feb 7, 2014 IP