Topic-icon [ANSWERED] How to avoid Likes on aggregated URL?

Active Subscriptions:

None
13 years 2 months ago - 13 years 1 month ago #32341 by Ludwig von Mises
I just got a Facebook Like on this page:
miraargentina.com/?fb_source=aggregation&fb_action_ids=4649357267384&fb_action_types=og.likes&fb_aggregation_id=246965925417366

How did the user manage to Like that page? I don't want any more of these FB aggregated URLs to be Liked. How can it be prevented?

I have Google Analytics Tracking "ON" for new Likes. Does that have something to do with it?

I'm sure this has been asked before but I couldn't find it in the forum search.

Thanks!
Last edit: 13 years 1 month ago by Ludwig von Mises.
The topic has been locked.
Support Specialist
13 years 2 months ago #32348 by alzander
Actually, that question hasn't been asked before. There is some logic in JFBConnect to strip some 'extra' parameters when a Like is clicked, but Facebook updates and adds them all the time.

One thing you can do is edit the /libraries/sourcecoast/utilities.php file. Around line 197, you'll see:
static function getStrippedUrl()
    {
        $href = JURI::current();

        $juri = JURI::getInstance();
        // Delete some common, unwanted query params to at least try to get at the canonical URL
        $juri->delVar('fb_comment_id');
        $juri->delVar('tp');
        $juri->delVar('notif_t');
        $juri->delVar('ref');
        $query = $juri->getQuery();
Update that as below to add the extra parameters that you're seeing:
static function getStrippedUrl()
    {
        $href = JURI::current();

        $juri = JURI::getInstance();
        // Delete some common, unwanted query params to at least try to get at the canonical URL
        $juri->delVar('fb_comment_id');
        $juri->delVar('tp');
        $juri->delVar('notif_t');
        $juri->delVar('ref');
        $juri->delVar('fb_source');
        $juri->delVar('fb_action_ids');
        $juri->delVar('fb_action_types');
        $juri->delVar('fb_aggregation_id');
        $query = $juri->getQuery();
That won't remove the query parameters from the address in the URL bar, but *should* remove them when a user clicks the Like button. It may take Facebook a few days to detect the updated URL Open Graph tag that will be set though.

I hope that helps, and definitely let us know what you find.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Alex, thanks for the incredibly detailed response. I think the problem is that people are arriving at the site through different portals in FB. What I just did was hardcode the homepage URL in the homepage {JFBCLike} tag so that whenever anyone lands on the homepage, through canvas, page tab, FB Like reference or anything else, no matter what crap is in the URL it will be the domain name itself that is liked.

That's what I think my problem was.

Thanks.
The topic has been locked.
Support Specialist
13 years 2 months ago #32437 by alzander
Your correct, Facebook will add extra query parameters. Google does the same thing with utm_campaign and other utm_xxyyzz parameters to the URLs that users are clicking through.

There are 2 solutions:
* If you are setting the href in the {JFBCLike} tag, that fixes the problem as the tag doesn't look at the current URL, it just uses the 'raw' URL that you set and it's guaranteed to be what you want.
* If you are using the {JFBCLike} tag (or comment tag, or any other social widget that takes an href) the code above will try to strip the common 'garbage' query strings before generating the Like button.

So, either way works, it just depends on how you're creating the button and whether it's dynamic or not.

Hope that explains, but if you need anything else, just let us know!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Just got an email from FB regarding App compliance. One warning is that my App is currently using the following deprecated features:

"Social Plugins (Like Button, Like Box) without absolute URL's in their `href` parameter."

Does this mean that the days of hard-coding a URL into a Like Button are coming to an end?
The topic has been locked.
Support Specialist
13 years 1 month ago #32945 by alzander
Ludwig,
No, the button will function pretty much as it has before. JFBConnect already supports the migration setting, and it will be enabled if you run the Autotune configuration tool in JFBConnect.

The href note is simply stating that if you use a Like button that points to a different page, you must use the full URL (ex. yoursite.com/link-to-page) instead of a relative URL, which Facebook used to support (ex. /link-to-page).

JFBConnect automatically generates an absolute URL when using our Like button. The only way you'd be in violation of the migration is if you implemented the JFBCLike tag or module and specifically used a relative URL, like {JFBCLike href=/link-to-your-page} That's generally not common and not something we've ever recommended.

As always though, you can enable the migration, test your Like buttons, and if you run into issues, disable the migration. That's the purpose of the migrations.. so that you can test before the are enabled for everyon. (in July)

Hope that helps,
Alex
The topic has been locked.