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.src=["https:"===location.protocol?"https://":"http://",""].join(""),a.parentNode.insertBefore(c,a))})(window,document,"script","smcx-sdk");</script>

Also i want to set this “” url dynamically added.

Like this

var url = "";
<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.src=["https:"===location.protocol?"https://":url].join(""),a.parentNode.insertBefore(c,a))})(window,document,"script","smcx-sdk");</script>

Thank you in advance.

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

  1. I have three surveys that I want to include in my website built with Angular but I don’t know how to do it. Should I do it as mentioned here? What do I have to do with the use of cookies, since I could only run one, I can only use another survey after deleting these cookies?

  2. I faced the same issue with the script and this is how I managed to integrate the survey monkey embed script in my angular application.

    In component.html

    <div  id="smcx-sdk"> </div>

    In component.ts

      var script = document.createElement('script');
      script.src = "http://<replace your widget url>";

    Make sure the element’s id is “smcx-sdk”.

    Hope this helps.


Leave a Comment