Skip to content

Instantly share code, notes, and snippets.

@nikhilatjumpcut
Last active August 7, 2019 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilatjumpcut/862813dfc644e28714bebb4c19f12770 to your computer and use it in GitHub Desktop.
Save nikhilatjumpcut/862813dfc644e28714bebb4c19f12770 to your computer and use it in GitHub Desktop.
replaceCTAAction.js
(function replaceCTAAction() {
var FUNNEL_URL = 'https://jumpcut.com/t';
var funnelAccess = window.__TSUNAMI__.funnelAccess;
var funnelSlug = window.__TSUNAMI__.funnelSlug;
var currentStepIndex = funnelAccess.findIndex(function(access) {
if (access.isCurrentStep) {
return true;
}
return false;
});
var closestSalesStep = funnelAccess.find(function(access, index) {
if (access.page.type === 'SALES' && index > currentStepIndex) {
return true;
}
return false;
});
var $ctaLinkButtons = $('a[href*="enroll"]');
if (!closestSalesStep) {
$ctaLinkButtons.attr('href', '#');
return;
}
var url = FUNNEL_URL + '/' + funnelSlug + '/' + closestSalesStep.slug;
$ctaLinkButtons.attr('href', url);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment