我从json字符串解析变量时遇到问题。变量(trackingID)是用于点击目标跟踪的动态网址参数,它会根据访问者来源动态更改。
var trackingID = window.location.search.substring(1);
clicky_custom.goal = { name: 'project-name - trackingID' };
答案 0 :(得分:2)
clicky_custom.goal = { name: 'project-name - ' + trackingID };
答案 1 :(得分:0)
这可能是您案例的合适解决方案
var trackingID = req.query.trackingID; //Get trackingID from query string
if(typeof trackingID != 'undefined'){
var name = {projectName: ''};
name.projectName = 'project-name ' + trackingID;
clicky_custom.goal = name
}