ConstantContacts integration

Hi,

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">
        <Container>
          <div className="constrantcontacts">
            <div className="row collapse">
              <script> var _ctct_m = "1234567890"; </script>
              <script id="signupScript" src="//static.ctctcdn.com/js/signup-form-widget/current/signup-form-widget.min.js" async defer></script>
            </div>
          </div>
        </Container>
      </Segment>
    );
  }
}

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?
Thanks

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!