In This Article:

    Save a tracking_code on a supporter_action record

    In This Article:

      A client asked if there were a way to set the tracking_code field in a new supporter_action record. There's not a way to do that in Salsa automatically, but it can be done with a bit of SalsaScript.

      Difficulty: +5 (Programming experience required.)


      This is a fairly complex solution that is only used in a situation where you're able to report on the contents of the supporter_action table. If that is not what you are doing, then this article is not for you.

      Installation Steps

      Use these steps to install the solution.

      1. Edit the template used by the action that you want to use to track supporter_action records.
      2. Use the browser's search too to locate the </head> tag.
      3. Insert a blank line just before the </head> tag.
      4. Click here to see the page where the solution lives.
      5. Click the Raw button. A window will appear that contains only the solution.
      6. Copy the contents of the window and close it.
      7. Return to the template editor.
      8. Paste the copied text into the newly inserted line in the template.
      9. Save the template.
      10. Leave the template editor open for the next step.


      The solution contains two configurable items. They are both SalsaScript (Javascript) variables and need to be modified fairly carefully.

      List of valid keys

      The first configurable item is the list of thank you page keys ( The variable contains a comma-separated list of keys.

      If the script is going to be used on one and only one thank you page, then the only change to to replace 547 with the thank you page of interest. If the script is going to work on more than one thank you page, then replace 547 with a comma-separated list of thank you page keys (no spaces, please). For example, to use the script on thank you pages with keys 123, 124, and 125, then the modified line would look like this:

      var validKeys = '123,124,125'.split(',');

      Page key

      The second configurable item is the URL query/parameter for the thank you page. Currently, this script works only with thank you pages. If you'd like to use, say, Tell-A-Friend pages, then the configuration line needs to specify a Tell-A-Friend key:

      var pageKey = Request.getParameter('tell_a_friend_KEY');

      Note that changing the pageKey to use Tell-A-Friend pages means that the the list of keys (above) must be a list of valid Tell-A-Friend keys.

      Use cases

      Here are a couple of use cases that you might find helpful.

      Provide a tracking code in the action URL

      In this case, the tracking code appears in the action URL.  This is a great way to attribute actions-taken to partners or to where the action appears in a page or email.  There are two parts to this use case.

      The first part is to configure the redirect for the action to pass a tracking code to the thank you page.  Here's an example (URL on separate lines to improve readability):

      The second part is to accept a tracking_code in the action URL.  Here's an example:

      Salsa will fill in the supporter_action_KEY parameter with the primary key of the newly created supporter_action record.  The tracking code will be filled with 'partner_1'.  That's all that the solution needs to do its work.

      Hard code a tracking code

      In this use case, the tracking code is static for all supporters that take the action.  For example, to pass "SupportedPizzaTrain" as a tracking tracking code, the action needs to redirect to this thank you page URL:

      As in the previous use case, the solution is provided the two parameters that it needs.


      If you have any questions, then please gather this information

      Send this information to, and we'll be glad to help.

      Was this article helpful?
      0 out of 0 found this helpful
      Have more questions? Submit a request



      Please sign in to leave a comment.