Untitled
unknown
plain_text
2 years ago
865 B
62
Indexable
<script>
// pegar os parametros da URL
function getUrlParam(name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results ? decodeURIComponent(results[1]) || 0 : false;
}
// criar um cookie
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
// checar se o parametro utm_sorce contem "fb"
var utm_source2 = getUrlParam('utm_source');
if (typeof utm_source2 === 'string' && utm_source2.includes("fb")) {
setCookie("coming_from", "fb", 7); // cookie expira em 7 dias
}
if (typeof utm_source2 === 'string' && utm_source2.includes("gg")) {
setCookie("coming_from", "gg", 7); // cookie expira em 7 dias
}
</script>Editor is loading...
Leave a Comment