Last active
September 15, 2017 20:14
-
-
Save wwwbruno/98ece780a4e16a675fa7a9c578252ec5 to your computer and use it in GitHub Desktop.
Fake pageview on RD Station Lead tracking
This file contains hidden or 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
/* References | |
http://www.w3schools.com/js/js_cookies.asp | |
https://github.com/ResultadosDigitais/rdocs/blob/master/integracoes_html_puro.md */ | |
function getCookie(cname) { | |
var name = cname + "="; | |
var ca = document.cookie.split(';'); | |
for(var i = 0; i <ca.length; i++) { | |
var c = ca[i]; | |
while (c.charAt(0)==' ') { | |
c = c.substring(1); | |
} | |
if (c.indexOf(name) == 0) { | |
return c.substring(name.length,c.length); | |
} | |
} | |
return ""; | |
} | |
function sendPageview(title, url) { | |
var token = 'rd-station-public-token', /* set your RD Station public token */ | |
client_id = JSON.parse(decodeURIComponent(getCookie('rdtrk'))).id; | |
jQuery.post('https://pageview-notify.rdstation.com.br/send', { token: token, title: title, url: url, client_id: client_id } ); | |
} | |
try { sendPageview('Fake page', 'http://yoursite.com/fake-page'); } catch(err) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment