我试图实现一种方法来跟踪 pinit 按钮,如此处所述
这是我的代码:
var fbUrl = RootLink;
var trackUrl = "//pinterest.com/pin/create/button/?url=" + RootLink + "&media=" +
RootLink + "trackPinit.php?userId=" + userId + "%26itemId=" +
items[cnt].item_id +
"%26image="+encodeURIComponent(items[cnt].item_img) +
"&description=Next%20stop%3A%20Pinterest";
trackUrl = encodeURIComponent(trackUrl);
var url = "<a href='JavaScript:newPopup(\"" + trackUrl + "\",\"" +
items[cnt].item_id +
"\");'><img src='//assets.pinterest.com/images/pidgets/pin_it_button.png'/></a>"
jQuery( "#i-cell-" + cnt_rows + "-" +
cnt_cells).append($("<div>").append($(url))
);
和php页面:
$userAgent = isset($_SERVER['HTTP_USER_AGENT'])
? $_SERVER['HTTP_USER_AGENT']
: '';\
if ( preg_match('/^Pinterest/d+.d+.*$/', $userAgent) ) {
echo "ccccc";
}
header('Location: ' . $_GET['image'] . "&size=" . $_GET['size'] .
"&tid=".$_GET['tid'] , true, 301
);
弹出窗口时上传图像,但是当我单击按钮 pinit 时,我收到错误“对不起,我们无法获取图像。”
你能帮忙找出问题所在吗?