Skip to content

Instantly share code, notes, and snippets.

@lcrespilho
Last active August 10, 2017 15:06
Show Gist options
  • Save lcrespilho/e756960d51195cde3aa8ae47d0291780 to your computer and use it in GitHub Desktop.
Save lcrespilho/e756960d51195cde3aa8ae47d0291780 to your computer and use it in GitHub Desktop.
<script>
// verifica se tem o cookie da Natura
var racc_origin = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*racc_origin\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
// se origem de tráfego for Natura
if (racc_origin && document.referrer.indexOf('/signup') >= 0) {
var urlPixel = 'https://www.facebook.com/tr/?id=235391240155676&ev=Lead&dl=' + encodeURIComponent(document.location.href) + '&rl=' + encodeURIComponent(document.referrer) + '&if=false&ts=' + Date.now() + '&cd%5Bsite_name%5D=Geekie&cd%5Bcontent%5D=Cadastro%20Finalizado&v=2.7.19&ec=1&o=28';
var pixel = document.createElement('img');
pixel.width = '1';
pixel.height = '1';
pixel.style.display = 'none';
pixel.src = urlPixel;
document.body.appendChild(pixel);
// remove o cookie para não disparar novamente para a mesma pessoa
document.cookie = 'racc_origin=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=geekie.com.br; path=/;';
}
</script>
@lcrespilho
Copy link
Author

lcrespilho commented Aug 9, 2017

Local de instalação da tag
Em qualquer lugar do <body> da página; de preferência no topo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment