0

I have to create subscribe and unsubscribe email page. all functionality is working fine. but when I call clevertap event, CT event is not triggered in CT dashboard.

 <script type="text/javascript">
    var clevertap = {
      event: [],
      profile: [],
      account: [],
      onUserLogin: [],
      notifications: [],
      privacy: [],

    };
    // replace with the CLEVERTAP_ACCOUNT_ID with the actual ACCOUNT ID value from your Dashboard -> Settings page
    clevertap.account.push({ id: "TEST-000-000-001Z" });
    clevertap.privacy.push({ optOut: false });
    clevertap.privacy.push({ useIP: true });
    (function () {
      var wzrk = document.createElement("script");
      wzrk.type = "text/javascript";
      wzrk.async = true;
      wzrk.test = 'page';
      wzrk.src =
        ("https:" == document.location.protocol
          ? "https://d2r1yp2w7bby2u.cloudfront.net"
          : "http://static.clevertap.com") + "/js/a.js";
      var s = document.getElementsByTagName("script")[0];
      console.log('s.parentNode : ', s.parentNode)
      s.parentNode.insertBefore(wzrk, s);
      wzrk.onerror = (e) => reject(new Error(`Failed to load script '${src}'. Error: ${e.toString()}`));
    })();
   
  </script>

onload I have call page view event

<script>
   window.onload = function () {
      console.log('on load');
      var isReEncode = false; //Should be true only if your server is url encoding the URL on unsubscribe landing page
      var withGroups = true; // Should be true if the unsubscribe groups should be displayed on the landing page.
      var stageName;
      $WZRK_WR.getEmail(false, withGroups);
      showSectionBaseOnStage();
      setTimeout(() => {
      clevertap.event.push("Page viewed", {
      "ProductName": "ABC",
      "PageTitle": "Unsubscribe",
      "Page": 'Group Unsubscribe',
      "PageURL": window.location.href,
      "SourceURL":""
      });
      console.log("on load ct event call", clevertap);
      }, 5000);
    };
</script>

Page viewed event not trigger

Please let me know where I do a mistake. Thank you

Vijay Prajapati
  • 738
  • 1
  • 7
  • 20

0 Answers0