Google Tag Manager custom Javascript: "Unknown variable {{Click Id}}" - Stack Overflow

I'm trying to access Click event related variables in custom javascript.Click event variables sho

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
Add a ment  | 

1 Answer 1

Reset to default 7

You 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信