CleverTap error: Incorrect embed script


#1

Trying to integrate clever tap into my react app produces the following error:

 index.js:2178 1539297526987 CleverTap error: Incorrect embed script.
 __stack_frame_overlay_proxy_console__ @ index.js:2178
 n.(anonymous function) @ rollbar.min.js:2
 a @ a.js:formatted:117
 b.Ga @ a.js:formatted:132
 (anonymous) @ a.js:formatted:1813

I’m calling the clever tap initialization code dynamically in a separate file, and calling it on the mounting of a react component:

const cleverTap = {
  initialize: function(accountId) {
    window.clevertap = { event: [], profile: [], account: [], onUserLogin: [], notifications: [] };
    window.clevertap.account.push({ id: accountId });
    (function() {
      const wzrk = document.createElement('script');
      wzrk.type = 'text/javascript';
      wzrk.async = true;
      wzrk.src =
        ('https:' === document.location.protocol
          ? 'https://d2r1yp2w7bby2u.cloudfront.net'
          : 'http://static.clevertap.com') + '/js/a.js';
      const s = document.getElementsByTagName('script')[0];
      s.parentNode.insertBefore(wzrk, s);
    })();
  },
}

on component mount:

    cleverTap.initialize(process.env.REACT_APP_CLEVERTAP_ACCOUT_ID);

on load the app does make a request to https://d2r1yp2w7bby2u.cloudfront.net/js/a.js but gives me the above error. what exactly is causing this problem?


#2

solved, account ID wasn’t being added to the initialize call