How to integrate survey monkey website embed in angular

I have survey monkey account, which have multiple surveys, i want to add this website embed survey in my angular website which have bootstrap and jquery already added. I tried with direct script in html component but its not working.

<script>(function(t,e,s,n){var o,a,c;t.SMCX=t.SMCX||[],e.getElementById(n)||(o=e.getElementsByTagName(s),a=o[o.length-1],c=e.createElement(s),c.type="text/javascript",c.async=!0,c.id=n,c.src=["https:"===location.protocol?"https://":"http://","widget.surveymonkey.com/collect/website/js/kjhasdkhkkjhk324234hkjhaksdkadhk.js"].join(""),a.parentNode.insertBefore(c,a))})(window,document,"script","smcx-sdk");</script>

Also i want to set this “widget.surveymonkey.com/collect/website/js/kjhasdkhkkjhk324234hkjhaksdkadhk.js” url dynamically added.

Like this

var url = "widget.surveymonkey.com/collect/website/js/kjhasdkhkkjhk324234hkjhaksdkadhk.js";
<script>(function(t,e,s,n){var o,a,c;t.SMCX=t.SMCX||[],e.getElementById(n)||(o=e.getElementsByTagName(s),a=o[o.length-1],c=e.createElement(s),c.type="text/javascript",c.async=!0,c.id=n,c.src=["https:"===location.protocol?"https://":url].join(""),a.parentNode.insertBefore(c,a))})(window,document,"script","smcx-sdk");</script>

Thank you in advance.

28 thoughts on “How to integrate survey monkey website embed in angular”

Leave a Comment