I'm trying to access Click event related variables in custom javascript. Click event variables should be so called built-in variables but still it states unknown.
I'm using following syntax which is supposed to get ID of clicked link and return social media action per ID:
function() {
var some = {{Click ID}};
if (some == "tw")
return 'tweet';
else
return 'share';
}
EDIT: For me it looks like I'm using variables just like on this page / but what is the problem?
I'm trying to access Click event related variables in custom javascript. Click event variables should be so called built-in variables but still it states unknown.
I'm using following syntax which is supposed to get ID of clicked link and return social media action per ID:
function() {
var some = {{Click ID}};
if (some == "tw")
return 'tweet';
else
return 'share';
}
EDIT: For me it looks like I'm using variables just like on this page http://www.apasters./blog/google-tag-manager-custom-javascript-variable-examples/ but what is the problem?
Share edited Jan 17, 2017 at 11:22 user1271930 asked Jan 17, 2017 at 11:17 user1271930user1271930 3411 gold badge8 silver badges22 bronze badges 2- can I just ask why there are no braces around your if statement? – Ben Davison Commented Jan 17, 2017 at 11:43
- There's no need for curly braces for single-line if statements, but I normally use them anyway for aesthetics, :) – nyuen Commented Jan 17, 2017 at 14:47
1 Answer
Reset to default 7You need to make sure that you have enabled/activated the built-in variables before you use them, otherwise you get that error message.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745055344a4608630.html
评论列表(0条)