Skip to content

Instantly share code, notes, and snippets.

@ermst4r
Created January 30, 2019 13:37
Show Gist options
  • Save ermst4r/33958a297337b007b39bbde83027b961 to your computer and use it in GitHub Desktop.
Save ermst4r/33958a297337b007b39bbde83027b961 to your computer and use it in GitHub Desktop.
Sendt pixel
var label_id = 6;
var campaign_id = 511;
var data = {
'email': email,
'campaign_id':campaign_id,
'firstname': voornaam,
'lastname': achternaam,
'lastname_prefix': '',
'label_id': label_id,
'gender': gender,
'birthdate': '',
'address': straatnaam,
'housenumber': huisnummer,
'housenumber_addition': toevoeging,
'postalcode': postcode,
'city': woonplaats,
'phone': telefoonnummer,
'publisher_id': publisher_id,
'transaction_id': transaction_id,
'user_agent': user_agent
};
$.ajax({
method:"POST",
url:"https://sendtportal.com/process_person",
dataType: 'json',
data:data,
success:function (data) {
if(data.conversion) {
var pixel = '<img src="https://sendt.go2cloud.org/aff_l?offer_id='+$.sendt.config.offerId+'" width="1" height="1" />';
pixel += '<img src="//trc.taboola.com/1150896/log/3/unip?en=lead" width="0" height="0" style="display:none"/>';
$( pixel ).appendTo('.tracking');
$.ajax({
method:"POST",
url:"https://sendtportal.com/process_question",
dataType: 'json',
data:{
'campaign_id': campaign_id,
'hash': data.hash,
'answers[huidige_energie_leverancier_nl]': $('select[name=energie]').val(),
'answers[type_woning]': $('select[name=woning]').val(),
'answers[gezinssamenstelling]': $('select[name=gezin]').val(),
'label_id':label_id
}
});
setTimeout(function(){
document.location.href = 'http://sendt.go2cloud.org/aff_c?offer_id=1721&aff_id=1231';
},6000);
} else {
setTimeout(function(){
document.location.href = 'http://sendt.go2cloud.org/aff_c?offer_id=1721&aff_id=1231';
},6000);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment