GTM JavaScript Compiler Error ECMASCRIPT6










0















My question is about I use JavaScript to send some form data from Webflow to Typeform. When I create a custom-html tag in Google Tagmanager I get this error:




JavaScript Compiler Error Typeform Tag

Error at line 3, character 1: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.




The same error occurs for line 4,5,6, 13, 14, 15.



This is my code:



<script>
$( "#formbutton" ).click(function()
const naam = $('#Naam-2').val();
const email = $('#Email-2').val();
const postcode = $('#Postcode-2').val();
Cookies.set('naam', naam, expires: 30 );
Cookies.set('email', email, expires: 30 );
Cookies.set('postcode', postcode, expires: 30 );
);

var Webflow = Webflow || ;
Webflow.push(function()
const naam = Cookies.get("naam");
const email = Cookies.get("email");
const postcode = Cookies.get("postcode");
$('#naam').val(naam);
$('#email').val(email);
$('#postcode').val(postcode);
);
</script>


Please, share your thoughts or any advices, would highly appreciate it! - thanks you in advance.










share|improve this question
























  • Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

    – Eike Pierstorff
    Nov 14 '18 at 16:12











  • Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

    – Nicolas Grenié
    Nov 15 '18 at 0:53











  • Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

    – Elien
    Nov 15 '18 at 12:22











  • It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

    – Elien
    Nov 20 '18 at 16:31















0















My question is about I use JavaScript to send some form data from Webflow to Typeform. When I create a custom-html tag in Google Tagmanager I get this error:




JavaScript Compiler Error Typeform Tag

Error at line 3, character 1: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.




The same error occurs for line 4,5,6, 13, 14, 15.



This is my code:



<script>
$( "#formbutton" ).click(function()
const naam = $('#Naam-2').val();
const email = $('#Email-2').val();
const postcode = $('#Postcode-2').val();
Cookies.set('naam', naam, expires: 30 );
Cookies.set('email', email, expires: 30 );
Cookies.set('postcode', postcode, expires: 30 );
);

var Webflow = Webflow || ;
Webflow.push(function()
const naam = Cookies.get("naam");
const email = Cookies.get("email");
const postcode = Cookies.get("postcode");
$('#naam').val(naam);
$('#email').val(email);
$('#postcode').val(postcode);
);
</script>


Please, share your thoughts or any advices, would highly appreciate it! - thanks you in advance.










share|improve this question
























  • Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

    – Eike Pierstorff
    Nov 14 '18 at 16:12











  • Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

    – Nicolas Grenié
    Nov 15 '18 at 0:53











  • Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

    – Elien
    Nov 15 '18 at 12:22











  • It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

    – Elien
    Nov 20 '18 at 16:31













0












0








0








My question is about I use JavaScript to send some form data from Webflow to Typeform. When I create a custom-html tag in Google Tagmanager I get this error:




JavaScript Compiler Error Typeform Tag

Error at line 3, character 1: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.




The same error occurs for line 4,5,6, 13, 14, 15.



This is my code:



<script>
$( "#formbutton" ).click(function()
const naam = $('#Naam-2').val();
const email = $('#Email-2').val();
const postcode = $('#Postcode-2').val();
Cookies.set('naam', naam, expires: 30 );
Cookies.set('email', email, expires: 30 );
Cookies.set('postcode', postcode, expires: 30 );
);

var Webflow = Webflow || ;
Webflow.push(function()
const naam = Cookies.get("naam");
const email = Cookies.get("email");
const postcode = Cookies.get("postcode");
$('#naam').val(naam);
$('#email').val(email);
$('#postcode').val(postcode);
);
</script>


Please, share your thoughts or any advices, would highly appreciate it! - thanks you in advance.










share|improve this question
















My question is about I use JavaScript to send some form data from Webflow to Typeform. When I create a custom-html tag in Google Tagmanager I get this error:




JavaScript Compiler Error Typeform Tag

Error at line 3, character 1: This language feature is only supported for ECMASCRIPT6 mode or better: const declaration.




The same error occurs for line 4,5,6, 13, 14, 15.



This is my code:



<script>
$( "#formbutton" ).click(function()
const naam = $('#Naam-2').val();
const email = $('#Email-2').val();
const postcode = $('#Postcode-2').val();
Cookies.set('naam', naam, expires: 30 );
Cookies.set('email', email, expires: 30 );
Cookies.set('postcode', postcode, expires: 30 );
);

var Webflow = Webflow || ;
Webflow.push(function()
const naam = Cookies.get("naam");
const email = Cookies.get("email");
const postcode = Cookies.get("postcode");
$('#naam').val(naam);
$('#email').val(email);
$('#postcode').val(postcode);
);
</script>


Please, share your thoughts or any advices, would highly appreciate it! - thanks you in advance.







javascript google-tag-manager typeform






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 0:52









Nicolas Grenié

3,32411129




3,32411129










asked Nov 14 '18 at 14:48









ElienElien

1




1












  • Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

    – Eike Pierstorff
    Nov 14 '18 at 16:12











  • Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

    – Nicolas Grenié
    Nov 15 '18 at 0:53











  • Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

    – Elien
    Nov 15 '18 at 12:22











  • It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

    – Elien
    Nov 20 '18 at 16:31

















  • Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

    – Eike Pierstorff
    Nov 14 '18 at 16:12











  • Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

    – Nicolas Grenié
    Nov 15 '18 at 0:53











  • Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

    – Elien
    Nov 15 '18 at 12:22











  • It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

    – Elien
    Nov 20 '18 at 16:31
















Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

– Eike Pierstorff
Nov 14 '18 at 16:12





Hi Elien, the problem is right in the error message. Declaring a variable as const is an ES6 feature and GTM does not support that. It should work if you just remove the const keyword.

– Eike Pierstorff
Nov 14 '18 at 16:12













Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

– Nicolas Grenié
Nov 15 '18 at 0:53





Hi Elien, Why don't you embed directly a Typeform in Webflow? Otherwise Eike's comments seems to be the way to go.

– Nicolas Grenié
Nov 15 '18 at 0:53













Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

– Elien
Nov 15 '18 at 12:22





Thanks @EikePierstorff, if I remove the 'const' the error indeed disappeared. However, the cookie is nog placed on the form fields of "Naam", "E-mail" and "Postcode". How can I make the cookie work so I'll be able to see it in the URL on the next page?

– Elien
Nov 15 '18 at 12:22













It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

– Elien
Nov 20 '18 at 16:31





It turned out to be blocked by our cookie consent, the code is indeed working without 'const'. Thanks for your response @EikePierstorff it worked out and @NicolasGrenie!

– Elien
Nov 20 '18 at 16:31












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302907%2fgtm-javascript-compiler-error-ecmascript6%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302907%2fgtm-javascript-compiler-error-ecmascript6%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo