Facebook Share/Like & URL Issue

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 7, 2013   (RSS)

Hi,

I've added fb like buttons across my website. When users like an article, fb generally adds a bunch of tags/parameters to the URL and when users click the link on facebook, they are given an error message: Record Not Found!

THis is how a shared/liked link looks like: http://www.illumemagazine.com/zine/articleDetail.php?The-Black-History-of-the-White-House-13745&fb_action_ids=4681431706510&fb_action_types=og.likes&fb_source=timeline_og&action_object_map=%7B%224681431706510%22%3A10150322600590421%7D&action_type_map=%7B%224681431706510%22%3A%22og.likes%22%7D&action_ref_map=[]

Is there a work around? Any suggestions?

Thanks!

Ah. That makes sense. Thank you Greg.

I will update the code. But that would mean that all the social sharing tracking count will restart based on the new URLs... Let me see if there's a way to tweak the fb share code so the long string isn't added in the URL..

By Dave - March 5, 2013 - edited: March 7, 2013

Hi Javed, 

Thanks for bringing this to our attention.  It looks like there is no way to get Facebook to not add extra content to the url so we're working on a patch for the next version that works around this.

If you'd like to try it out early and you are comfortable making PHP code edits you can do the following:

  • Open /lib/viewer_functions.php
  • Search for _utm
  • Replace this:

    // remove google utm_ campaign tracking values from url as they might contain numbers.  utm names: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55578
    $urlData = preg_replace("/&utm_\w+=[^&]*/", '', $urlData);

  • With this:

    // 2.52 - remove 3rd party field-value pairs from query string as they might contain trailing numbers
    $removeFields  = array(
      'utm_source','utm_medium','utm_term','utm_content','utm_campaign',          // google utm names: http://www.google.com/support/googleanalytics/bin/answer.py?answer=55578
      'fb_source','fb_action_ids','fb_action_types','fb_ref','fb_aggregation_id', // facebook parameter names: https://developers.facebook.com/docs/technical-guides/opengraph/link-parameters/
      'action_object_map','action_type_map','action_ref_map',                     // additional facebook parameters
    );
    foreach ($removeFields as $removeField) { $urlData = preg_replace("/&$removeField=[^&]*/", '', $urlData); }

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By Dave - March 7, 2013

Hi All, 

Just an update that this code is now in 2.52 beta 1 and will be in the official release.  

Thanks!

Dave Edis - Senior Developer
interactivetools.com