Created
August 28, 2021 22:57
-
-
Save LucasGorgal/c16131957ee3da0935a436f279691744 to your computer and use it in GitHub Desktop.
deeplink yt com pixel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$video_id = "a8D1eF5NBCg"; //Id do vídeo do YT | |
$ipod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod"); | |
$iphone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone"); | |
$android = stripos($_SERVER['HTTP_USER_AGENT'], "Android"); | |
if($ipod || $iphone) { | |
$url = "vnd.youtube://www.youtube.com/watch?v=$video_id&v=$video_id"; | |
} else if($android) { | |
$url = "intent://www.youtube.com/watch?v=$video_id#Intent;package=com.google.android.youtube;scheme=https;end"; | |
} else { | |
$url = "https://www.youtube.com/watch?v=$video_id"; | |
} | |
$mobile_fallback = "https://www.youtube.com/watch?v=$video_id"; | |
?> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<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'); | |
fbq('init', '1502494303320239'); //Id do pixel | |
fbq('trackCustom', 'CPL-1'); //Conversão | |
</script> | |
<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1502494303320239&ev=PageView&noscript=1"/></noscript> <!-- Id do pixel --> | |
<!-- MUDAR TUDO COM CONVERSÃO DO GOOGLE ADS --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-810179376"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'AW-810179376'); | |
gtag('event', 'conversion', {'send_to': 'AW-810179376/LsyjCLqa3O8CELC2qYID'}); | |
</script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
window.setTimeout(function() { | |
window.location.href = "<?php echo $url; ?>"; | |
}, 2000); | |
window.setTimeout(function() { | |
window.location.href = "<?php echo $mobile_fallback; ?>"; | |
}, 2500); | |
</script> | |
<h1>Estamos te redirecionando em alguns segundos...</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment