Hi good morning,
My name is Roger and I'm working as a freelance front-end web developer creating some e-commerce websites.
In this particular case I would like to modify or create a custom module to be able to store in a cookie the referal website of the users and If there is a purchase, send this information inside the email. The referal website are suppliers of my main store.
Let me explain it with an example:
My store is: www.abrildissenys.com
A store with a backlink to my site: www.shop1.com
Another store with a backlink to my site: www.shop2.com
The backlinks these two websites have to my store are: www.abrildissenys.com?supplier=shop1, www.abrildissenys.com?supplier=shop2
I would like to store this two parameters inside a cookie, I don't know if I have to modify a JS or a TPL. I have found this javascript code to get the paramaters info but I'm not able to make it work.
Can somebody help me?
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
Thank You!
Roger