1. How to remove the second link without affiliate parameters when Facebook displays a shared banner?

We can not directly affect how Facebook will display a shared link. But Facebook will disable the second link to your domain, when the banner target URL does not contain 'www' subdomain. Example:

 - If your banner destination url is 'http://www.yoursite.com', change it to 'http://yoursite.com'.

Some webservers may not work without 'www' subdomain. In this case you have to setup a redirection using an .htaccess file. In the root folder of your web site create a file named as '.htaccess', with the following content:
Options +FollowSymlinks
RewriteEngine on

RewriteCond %{http_host} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
Change 'yoursite.com' to your real domain name. Now every user who enters 'http://yoursite.com/page/welcome.html' will be redirected to 'http://www.yoursite.com/page/welcome.html' and all the URL parameters will be preserved.

2. Why do i see image of destination URL page instead of image of my banner?
 
That is because of facebook style of sharing URL links. But there is a way around if you want to see images of banners instead of preview of destination URL. You must have acces to the source codes of the destination page. You need to change/add OpenGraph OG tags to <head> section of the website which you are promoting with the banner links. The below steps explain how to do it and some more details are found at the end of the article below the code.
 
1. in your server find the file the  banner destination URL points to and  upload to the particular directory the PapApi.class.php file. You can download this  PapApi.class.php file from your 
merchant panel of Post Affiliate Pro at Tools > Integration > API Integration > Download PAP API
 
NOTE: In case you use some CMS, then you have to find its header file that is included in every page (article). 
 
2. place the following code into header of your banner's destination page:
 
NOTE: This code works only with the 'New style links' linking method. In case you happen to use other linking method, then after the banner is created in Post Affiliate Pro you have to get it's ID (banner ID) at Banners > Banners manager by enabling the 'ID' column via "Edit view" and then append to the Destination URL of the banner this:
?a_bid=TheObtainedBannerId   OR  &a_bid=TheObtainedBannerId

while of course the TheObtainedBannerId must be replaced with the found banner id. 
NOTE2: 'a_bid' is the default URL parameter name representing the  banner id. Check in the merchant panel at Configuration > URL parameter names if it is still that way (maybe you renamed it in the past). If you did rename it then lower in the code on line 6 replace a_bid with the one you have in panel.
<?php

$bannerParameter='a_bid';

function papLogin(){
    try {
        /* This include_once assumes the PapApi.class.php file is in the same directory as this php script */
        include_once 'PapApi.class.php';
        @$session = new Pap_Api_Session("http://URLtoPostAffiliatePro/scripts/server.php");
        if(!@$session->login("merchant@example.com", "password")) {
          return false;
        }
        return $session;
    }catch (Exception $e){
        return false;
    }
    return false;     
}
 
if (isset($_GET[$bannerParameter])) {
    if ($session = papLogin()){
        /* $session->setDebug(true); */
        $request = new Pap_Api_BannersGrid($session);
        $request->setLimit(0, 1);
        $request->addFilter('bannerid',Gpf_Data_Filter::EQUALS,$_GET[$bannerParameter]);
        $request->addParam('columns', new Gpf_Rpc_Array(array(array('id'), array('destinationurl'), array('description'), array('name'), array('data1'))));
 
        try {
            $request->sendNow();
            $grid = $request->getGrid();
            /* get recordset from the grid */
            $recordset = $grid->getRecordset();
            $totalRecords = $grid->getTotalCount();     
            if ($totalRecords>0) {
                foreach($recordset as $rec) {
                    $name=$rec->get('name');
                    $description=$rec->get('description');
                    $image=$rec->get('data1');
                    $url=$rec->get('destinationurl');
                    
                    /* check if image URL has protocol, if not add it */
                    if (substr( $image, 0, 2 ) === "//") {
                        $image='http:'.$image;
                    }
                    
                    /* check destination URL whether it contains anchor or URL parameters and insert banner ID appropriately */
                    if (strpos($url, '?') === false) {
                        if (strpos($url, '#') !== false) {
                            $AnchorPosition=strpos($url, '#');
                            $url = substr_replace($url, '?'.$bannerParameter.'='.$_GET[$bannerParameter], $AnchorPosition, 0);
                        } else {
                            $url.='?'.$bannerParameter.'='.$_GET[$bannerParameter];
                        }
                    } else {
                        if (strpos($url, '#') !== false) {
                            $AnchorPosition=strpos($url, '#');
                            $url = substr_replace($url, '&amp;'.$bannerParameter.'='.$_GET[$bannerParameter], $AnchorPosition, 0);
                        } else {
                            $url.='&amp;'.$bannerParameter.'='.$_GET[$bannerParameter];
                        }
                    }
                    $imageinfo=getimagesize($image);
                    $imagewidth = $imageinfo[0];
                    $imageheight = $imageinfo[1];                    
                    echo '<meta property="og:title" content="'.$name.'" />'.PHP_EOL;
                    echo '<meta property="og:description" content="'.$description.'" />'.PHP_EOL;
                    echo '<meta property="og:image" content="'.$image.'" />'.PHP_EOL;
                    echo '<meta property="og:image:width" content="'.$imagewidth.'" />'.PHP_EOL;
                    echo '<meta property="og:image:height" content="'.$imageheight.'" />'.PHP_EOL;
                    echo '<meta property="og:url" content="'.$url.'" />'.PHP_EOL;
                }
            }
        } catch (Exception $e){}
    }  
}
?>
 
The point is to add these four tags to your <head> tag in the banner's destination page:
 
<meta property="og:title" content="title" />
<meta property="og:description" content="desc" />
<meta property="og:image" content="image" />
<meta property="og:url" content="url" />
 
After that if there is a_bid in the URL address, for example:
http://www.example.com?a_bid=12345678
 
these four tags are generated in the page header, and facebook now can see them and show proper image preview, title and description.
 
If you still can't see your banner on your facebook put your banner code on some sample page on the web and then put link to it here:
 
Facebook will detect all possible errors.
 
Most common issue why facebook does not show the image of the shared banner is that one of the sizes of the image (width or height) is not at least 200px.

Other Articles