0

I have an empty page, that does one custom tracking function, then redirect back to facebook.

http://example.com/promotion/?promotion-id=12

What's inside the link is:

if(isset($_GET['promotion-id'])) {
   addTracker($_GET['promotion-id']);
}
header('Location: http://facebook.com/promotionexample') ;

The problem is, when I share the link http://example.com/promotion/?promotion-id=12 to facebook, Facebook processed it and change the link directly to http://facebook.com/promotionexample.

I understand that this is a mechanism to share bit.ly or any other url shortener. But is there any way to avoid it?

AlbertSamuel
  • 584
  • 10
  • 33
  • 1
    You would need to add an exception to your automatic redirect, so that the Facebook scraper does not get redirected, and served the appropriate OG meta data instead. (FB scraper can be recognized by its User-Agent header, see social plugins FAQ.) – CBroe Aug 21 '17 at 07:31
  • Thank you @CBroe. Your explanation directs me to the right search terms. Answered in: https://stackoverflow.com/questions/8626812/how-to-recognize-facebook-user-agent – AlbertSamuel Aug 22 '17 at 00:28

0 Answers0