MediaWiki:DonationForm.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
remove variant=redirect code - handled on payments now |
new buildUtmSource method to replace addAnalytics |
||
Line 618: | Line 618: | ||
return false; // don't submit if called by a button |
return false; // don't submit if called by a button |
||
}; |
}; |
||
/** |
|||
* Build a utm_source value, including the landing page info. |
|||
* |
|||
* Note this doesn't include payment method, that's added in redirectPayment method |
|||
* |
|||
* @return {string} utm_source |
|||
*/ |
|||
donationForm.buildUtmSource = function() { |
|||
var utm_source = mw.util.getParamValue( 'utm_source' ) + '.'; |
|||
var getParam = function( param, removeText, dflt ) { |
|||
if ( mw.util.getParamValue( param ) ) { |
|||
return mw.util.getParamValue( param ).replace( removeText, '' ); |
|||
} else { |
|||
return dflt; |
|||
} |
|||
} |
|||
/* The landing page info, separated by ~. This mostly exists for legacy reasons */ |
|||
utm_source += getParam( 'template' , 'Lp-layout' , 'default' ) + '~'; |
|||
utm_source += getParam( 'appeal-template' , 'Appeal-template-' , 'default' ) + '~'; |
|||
utm_source += getParam( 'appeal' , 'Appeal-' , 'default' ) + '~'; |
|||
utm_source += getParam( 'form-template' , 'Form-template-' , 'default' ) + '~'; |
|||
utm_source += getParam( 'form-countryspecific', 'Form-countryspecific-', 'control' ); |
|||
return utm_source; |
|||
} |
|||
donationForm.addAnalytics = function() { |
donationForm.addAnalytics = function() { |