user1271930
user1271930

Reputation: 341

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

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.com/blog/google-tag-manager-custom-javascript-variable-examples/ but what is the problem?

Upvotes: 4

Views: 3718

Answers (1)

nyuen
nyuen

Reputation: 8907

You need to make sure that you have enabled/activated the built-in variables before you use them, otherwise you get that error message.

Upvotes: 7

Related Questions