Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to add a value for supporter_action.tracking_code. The value is added using a SalsaScript that appears in the page that follows the action. The example is coded to work with thank you pages. Change the logic to use any other page you like.
// Submit tracking_code to the supporter_action table. Uses the contents of
// the URL to submit supporter_action.tracking code for qualifying thank you pages.
// Customization:
// Change line 7 to be a comma-separated list of page keys. (no spaces)
// Change line 8 to choose the page type and retrieve the page key of interest.
(function() {
// Comma-separated list of thank you pages where this script will run.
var validKeys = '547'.split(',');
var pageKey = Request.getParameter('thank_you_page_KEY');
if (pageKey == null) return;
if (validKeys.indexOf(pageKey) == -1) return;
var supporterActionKey = Request.getParameter('supporter_action_KEY');
if (supporterActionKey == null) return;
var track = Request.getParameter('track');
if (track == null) return;
DB.saveObject('supporter_action', { tracking_code: track }, supporterActionKey);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.