I’m trying to install a facebook event pixel that will send information from url tags. My code reads the url tags as strings. I can retrieve them easly, and output them, but when I want to convert them from string or char-sequence to integer the code doesn’t work.
Am I missing something?
this is the code:
——————————————
<script>
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
var priceTotS= getUrlVars()[“priceTot”];
var ticketsS= getUrlVars()[“tickets”];
priceTotS=priceTotS.replace(“%20″, ”);
ticketsS=ticketsS.replace(“%20″, ”);
// problematic code that prevents the code from running
int priceTot= Integer.parseInt(priceTotS);
int tickets= Integer.parseInt(ticketsS);
// end of problematic code
// document.write(tickets);
// document.write(” | “);
// document.write(priceTot);
fbq(‘track’, ‘Purchase’, {
value: priceTot,
currency: ‘ILS’,
contents: [
{
quantity: tickets
}
],
content_type: ‘Sifting_Heb’,
});
</script>
Hey tmsifting,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Basilis