EarlyParrot subscribe call API on the next page after the opt-in page

As a pre-requisite for your Clickfunnels HTML email form integration, you will first need to create EarlyParrot tracking hidden fields.

Once you have created the required hidden fields in your opt-in form, then you can follow these steps to add CUSTOM JAVASCRIPT / HTML element on the next page after the opt-in step.

Locate the next page after the opt-in step.

Edit the page.

Add a Custom Javascript / HTML element.

Paste the following code. Make sure you replace YOUR_CAMPAIGN_ID with your campaign id and YOUR_DOMAIN.com with your full domain (without www).

<script>
  var epVars = {
    adminUrl: "https://admin.earlyparrot.com",
    appUrl: "https://app.earlyparrot.com",
    campaignId: "YOUR_CAMPAIGN_ID"
};
</script>
<script>
(function(w, d, url) {
    var headElementUtils = d.getElementsByTagName('head')[0];
    var scriptElementUtils = d.createElement('script');
    scriptElementUtils.addEventListener('load', function() {
        epJQuery(document).ready(function() {
            var emailValue = localStorage['garlic:'+document.location.host+'*>input.email'];
            if (emailValue) {
                var ep_subscribeObj = new Object();
                ep_subscribeObj.firstName =localStorage['garlic:'+document.location.host+'*>input.name'];
                ep_subscribeObj.lastName = "";
                ep_subscribeObj.email = localStorage['garlic:'+document.location.host+'*>input.email'];
                ep_subscribeObj.rh = localStorage['rh'];
                ep_subscribeObj.sendWelcomeImmediately = 0; //will not send welcome email 
                Cookies.set('epSubmitEmail', ep_subscribeObj.email, {
                    domain: 'YOUR_DOMAIN.com'
                });
                epJQuery.post("https://admin.earlyparrot.com/api/campaigns/YOUR_CAMPAIGN_ID/subscribe", ep_subscribeObj)
                    .then(function(data) {
                        var headElement = d.getElementsByTagName('head')[0];
                        var scriptElement = d.createElement('script');
                        scriptElement.async = 1;
                        scriptElement.src = "https://s3.amazonaws.com/earlyparrot-production-scripts/ep-share-page.js"
                        headElement.appendChild(scriptElement);
                    });
            } else {
                var headElement = d.getElementsByTagName('head')[0];
                var scriptElement = d.createElement('script');
                scriptElement.async = 1;
                scriptElement.src = "https://s3.amazonaws.com/earlyparrot-production-scripts/ep-share-page.js"
                headElement.appendChild(scriptElement);
            }
        });
    });
    headElementUtils.async = 1;
    scriptElementUtils.src = url
    headElementUtils.appendChild(scriptElementUtils);
})(window, document, 'https://s3.amazonaws.com/earlyparrot-production-scripts/utilities.js');
</script>
<style>
@media (min-width: 576px) {
  .epWrapper {
     height: 890px;
  }
}
@media (max-width: 577px) {
  .epWrapper {
    height: 890px
  }
}
.epWrapper {
  position: relative;
}
.epWrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
</style>
<div class="epWrapper">
<iframe id="epShare" allowfullscreen="" frameborder="0" src=""></iframe>
</div>