ConstantContacts integration


I'm trying to integrate ConstantContacts popup into volto. I defined the component below and added it to my footer:

class ConstantContactsFooter extends Component {
  render() {
    return (
      <Segment basic className="constant-contacts-wrapper">
          <div className="constrantcontacts">
            <div className="row collapse">
              <script> var _ctct_m = "1234567890"; </script>
              <script id="signupScript" src="//" async defer></script>

But when I load the page, I get this in my browser console

Missing critical variable "_ctct_m". Please copy paste universal code from account again.

I followed their help page here. I also tried a few variations without success.

Anyone done this before?

See " Using useEffect Hook to Load External .js Files" on How to load .js src from script tag in ReactJS

In the useEffect, before adding the script element to the DOM, I think you need to do, the equivalent of that global variable:

window._ctct_m = "123456"
1 Like

That works. Thanks @tiberiuichim!