Difficulty using Analytics JS code in Workflow JS step

I am trying to use this simple JS event trigger script for CleverTap (A product analytics tool) but can’t seem to get this code to fire. It is working fine within JSFiddle, but not working when using the JS action in a Workflow, as I want to trigger this event on button clicks.

Here is the code I am trying to use:

  var name = "Full Name";
  var email = "some@email.com";
  var identity = 1;
    "Site": {
      "Name": name,
      "Identity": identity,
      "Email": email,

This of course requires the CleverTap code to be loaded on the page and I am doing that from the global “Custom code” option. If needed, here is the global custom code used by CleverTap:

<script type="text/javascript">
var clevertap = {event:[], profile:[], account:[], onUserLogin:[], notifications:[], privacy:[]};
clevertap.spa = true;
clevertap.account.push({"id": "???-????-????"});
clevertap.privacy.push({optOut: false}); //set the flag to true, if the user of the device opts out of sharing their data
clevertap.privacy.push({useIP: true}); //set the flag to true, if the user agrees to share their IP data
 (function () {
         var wzrk = document.createElement('script');
         wzrk.type = 'text/javascript';
         wzrk.async = true;
         wzrk.src = ('https:' == document.location.protocol ? 'https://d2r1yp2w7bby2u.cloudfront.net' : 'https://static.clevertap.com') + '/js/clevertap.min.js';
         var s = document.getElementsByTagName('script')[0];
         s.parentNode.insertBefore(wzrk, s);

Would appreciate it if anyone have any suggestions or have used something similar before and could share some tips.


Have you tested it in a published app? There might be a limitation there, and it could be working.

If there is no limitation, just FYI that you want to make sure that your clicks in a non published app are not being passed through to your analytics.


The code added in the header of a page or an app is added on the published app only, not the editor. As @twinsticks mentioned, you’ll need to test on the published app.

@twinsticks @Quentin Thank you both.
Yes, indeed, I am testing on the published app, I have even tried to copy the full code (so this trigger code + sdk) from JSFiddle, where it is working, to Webweb, but I can’t seem to get it to trigger from within Weweb.

Could there be some sort of limitation in the JS action step? Something that stops it from communicating with external sources for security reasons or something?


Could you file a bug on support.weweb.io ? We’ll have a look. Thanks!