我们想要一种方式来跟踪通过未通过Marketo发送的邮件来点击PDF链接的潜在客户。我们也不希望打开PDF文件(要求我们的客户填写表格)来访问文件。在谈到支持和淘汰Marketo四维支持网站之后,我了解到(我认为)实现这一目标的唯一方法是制作REST API调用,并尝试从PC上的cookie文件获取主要信息(将会访问我们的PDF是已知的客户,而不是普通大众)我不是专家的编码员,所以我从我的研究中修补了这段代码,足以说它不工作,任何帮助将不胜感激。根据Marketo Cookie提供的潜在客户信息自动填充Marketo表单字段
<script src="//xxx.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2244" style="display:none"></form>
<script>MktoForms2.loadForm("//xxx.marketo.com", "xxx-xxx-xxx", 2244);</script>
<script>
MktoForms2.whenReady(function(form) {
//OnSuccess is optional - only if you need to make client-side decisions about Thank You URL
form.onSuccess(function(vals, tyURL) {
location.href = 'http://www.1234.com/rs/xxx-xxx-123/images/somepdffile.pdf';
return false;
});
//Get LEAD info from cookie
var mktoGet = new XMLHttpRequest();
mktoGet.open("GET", "https://xxx-xxx-xxx.mktorest.com/rest/v1/leads.json?filterType=cookie&filterValues=<cookie>&fields=email,firstName,lastName&access_token=<token>", false);
mktoGet.send();
//set the first result as local variable
var mktoLeadFields = mktoLead.result[0];
//map your results from REST call to the corresponding field name on the form
var prefillFields = {
"Email" : mktoLeadFields.email,
"FirstName" : mktoLeadFields.firstName,
"LastName" : mktoLeadFields.lastName
};
//pass our prefillFields objects into the form.vals method to fill our fields
form.vals(prefillFields);
});
//Submit the form
form.submit();
});
</script>
p.s.我替换和值,一旦我粘贴在浏览器中的链接,我得到了一个成功的结果。
任何人都知道如何将一个条件添加到代码后,删除任何东西“?”在一个链接? – Rayyis