Hello. I am using this code for inside custom HTML tag of google tag manager.
It says:
" Error at line 11, character 41: Parse error. primary expression expected "
Can you help me with this one? What could be the issue?
<script>
(function() {
try {
var firstName = document.querySelector("#comp-k8lltx14input").getAttribute("value");
var lastName = document.querySelector("#comp-kc3nlravinput").getAttribute("value")
var phoneNumber = document.querySelector("#comp-kc3nludbinput").getAttribute("value");
var email = document.querySelector("#comp-kagda0brinput").getAttribute("value");
var website = document.querySelector("#comp-kcg4s16iinput").getAttribute("value");
if(firstName != "" && lastName != && phoneNumber != "" && email != "" && website != ""){
return window.dataLayer.push({
'event': 'ClientInfo',
'First Name': firstName,
'Last Name': lastName,
'Phone': phoneNumber,
'email': email,
'website': website
})}
} catch(e) {
return undefined;
}
})();
</script>