2017-12-12 24 views
2

** 내가 찾고있는 것 : ** 내가 찾고있는 것은 내 웹 사이트 사용자 정보를 추적하여 페이스 북에 보내기 위해 내 사이트의 페이스 북 픽셀을 제한하는 방법입니다.웹 사이트에서 Facebook 픽셀에 대한 수신 거부 옵션을 만드는 방법은 무엇입니까?

내가 이미 알고있는 것 : Facebook 픽셀은 google 태그와 같은 사용자 데이터를 추적합니다. 그러나 Google은 사용자가이 옵션을 선택하도록 허용하는 스크립트를 제공합니다. 즉, 사용자 정보는 추적되지만 Google에 전송되지 않습니다.

<script> 
// Set to the same value as the web property used on the site 
var gaProperty = 'UA-XXXX-Y'; 

// Disable tracking if the opt-out cookie exists. 
var disableStr = 'ga-disable-' + gaProperty; 
if (document.cookie.indexOf(disableStr + '=true') > -1) { 
window[disableStr] = true; 
} 

// Opt-out function 
function gaOptout() { 
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; 
window[disableStr] = true; 
} 
</script> 

지금 내 페이스 북 픽셀에 대한 유사한 옵션을 갖고 싶어하기 때문에 사용자는 데이터에서 추적을 해제 할 수 있습니다 : 여기

이 구글에서 제공하는 옵트 아웃 옵션의 코드 ( source)입니다 페이스 북. 실제로 사용하는 것은 내 웹 사이트의 특정 이벤트에 대한 정보를 추적하는 페이스 북의 제공 코드입니다. 다음은 지금 사용하는 코드입니다 ( source) :

<!-- Facebook Pixel Code --> 
<script> 
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? 
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; 
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; 
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, 
document,'script','https://connect.facebook.net/en_US/fbevents.js'); 
// Insert Your Facebook Pixel ID below. 
fbq('init', 'FB_PIXEL_ID'); 
fbq('track', 'PageView'); 
</script> 
<!-- Insert Your Facebook Pixel ID below. --> 
<noscript><img height="1" width="1" style="display:none" 
src="https://www.facebook.com/tr?id=FB_PIXEL_ID&amp;ev=PageView&amp;noscript=1" 
/></noscript> 
<!-- End Facebook Pixel Code --> 
+0

Facebook은 그런 내용을 제공하지 않습니다. 필요한 경우 사용자가 직접 옵티 마이저를 구현하면됩니다 (FB 픽셀 코드 _at all_를 사용자가 옵트 아웃하지 않는 경우). – CBroe

답변

1

이렇게하면됩니다. 페이스 북 코드가 실행되기 전에 "customOptout()"을 호출하면 거부 쿠키가 설정되고 페이스 북 픽셀이 초기화되지 않습니다.

<!-- Modified Facebook Pixel Code --> 
<script> 
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? 
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; 
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; 
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, 
document,'script','https://connect.facebook.net/en_US/fbevents.js'); 

var disableStr = 'custom-disable'; 
if (document.cookie.indexOf(disableStr + '=true') > -1) { 
    // don't fire facebook beacon 
} else { 
    // Insert Your Facebook Pixel ID below. 
    fbq('init', 'FB_PIXEL_ID'); 
    fbq('track', 'PageView'); 
} 


function customOptout() { 
    document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; 
} 

</script> 
<!-- Insert Your Facebook Pixel ID below. --> 
<noscript><img height="1" width="1" style="display:none" 
src="https://www.facebook.com/tr?id=FB_PIXEL_ID&amp;ev=PageView&amp;noscript=1" 
/></noscript> 
<!-- End Modified Facebook Pixel Code -->