Last active
January 25, 2017 22:48
-
-
Save salsalabs/c075af5eff88d1b0016b211249c394d4 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// 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