2017-09-14 75 views
0

我正在嘗試創建自定義JavaScript GTM變量。Google Tag Manager自定義JavaScript解析錯誤

但它總是告訴我,我有一個語法錯誤...

Error at line 4, character 53: Parse error. ')' expected

但我看不出問題。任何想法什麼是錯的?

function() { 
 
    var clickclasses = "{{Click Classes}}"; 
 
    if (clickclasses.includes("download-color-wheel") { 
 
    return "Downloaded Color Wheel"; 
 
    } 
 
    if (clickclasses.includes("lp-10%-coupon") { 
 
    return "Claimed 10pct Coupon on Landing Page"; 
 
    } 
 
    if (clickclasses.includes("exit-popup-10%-coupon") { 
 
    return "Claimed 10pct Coupon on Exit Popup"; 
 
    } 
 
    if (clickclasses.includes("video-testimonial-submitted") { 
 
    return "Video Testimonial Submitted"; 
 
    } 
 
    return "Clicked"; 
 
}

回答

0

右括號if語句丟失。

更新代碼:

function() { 
    var clickclasses = "{{Click Classes}}"; 
    if (clickclasses.includes("download-color-wheel")) { 
    return "Downloaded Color Wheel"; 
    } 
    if (clickclasses.includes("lp-10%-coupon")) { 
    return "Claimed 10pct Coupon on Landing Page"; 
    } 
    if (clickclasses.includes("exit-popup-10%-coupon")) { 
    return "Claimed 10pct Coupon on Exit Popup"; 
    } 
    if (clickclasses.includes("video-testimonial-submitted")) { 
    return "Video Testimonial Submitted"; 
    } 
    return "Clicked"; 
} 
+0

你的答案是correct.please闡述更多發佈更正代碼。 – prasanth

+0

對不起,但我很困惑,你能發佈正確的代碼來幫助我看看嗎? – bennygill

相關問題