You can use URL arguments to customize the experience your activists have when signing actions. You can do things like pre-fill donation amounts or redirect an activist to a certain page, all using the URL link. All of these URL arguments work on pages hosted on Action Network, as well as pages where you have an Action Network widget embedded.
First off, what's a URL? A URL is a link, like https://your-website.com or https://actionnetwork.org/fundraising/donate-to-amys-test-group.
Also known as query strings, parameters, or URL variables, URL arguments are the portion of a URL that follows a question mark. On Action Network, URL arguments do not change the content of the page. Rather, they are used mainly for tracking or pre-populating data on a form. With a simple URL argument added to the end of your links, you can pass tracking information, form field data, and more cool stuff.
Let's break down how a URL is structured and the rules behind it. Let's start out with your basic, "clean" link to your website. It's the shortest link to get you to where you want to go:
Anything that follows that basic, bare-bones URL is an argument/parameter/query string. There are two parts of a URL argument: a key and a value. The key is the name of the argument you are entering — like the name of the field you're pre-filling or thing you're tracking. You may also see it called a variable. The value is what should be filled or tracked at that link — like the input for the field you're pre-filling or the tracking code for the thing your tracking.
There are three symbols used in URL arguments.
- ? The question mark identifies the beginning of the URL arguments and must be placed at the end of the link, before the contents of the arguments. There can only be one question mark in the entire URL.
- & The ampersand is used before each subsequent argument (key/value pair) in the URL.
- = The equals sign separates the key from the value assigned to that key.
Here's what each of those looks like in action:
Then, you add your key and value pair.
Multiple arguments can be added to a single page by using an ampersand.
There's a few rules to keep in mind as far as URL arguments are concerned.
- Beware of special characters. We recommend only using numbers, letters, dashes, and underscores in your values.
- Really, beware of special characters. Here's a list of unsafe characters.
- The entire URL should only have one question mark. No more, no less.
- Encode your URL arguments when using special characters (anything that is not alphanumeric, a dash, or an underscore). Encoding converts characters not normally allowed in URLs into a form that can be transmitted. For example, it turns spaces into %20 and a slash into %2F. This is especially useful for the URL argument for redirecting an activist from a Thank You page. More on encoding here. And here's a URL encoder we like.
- TEST YOUR LINKS. PLEASE MAKE SURE THEY WORK.
Here's a list of all the things you can do with URL arguments:
Source codes allow you to track which link an activist clicked on order to get to your action page and take action. Source codes are automatically added to links in emails, and links created by pressing the 'like' or 'tweet' buttons on the thank you page of an action. But you can create your own source codes so they can be used with any link you send —whether it was a link posted to social media, an email, your website, or anything else.
You can target by source codes in emails and reports, which is helpful to see which source brings in the most new or existing activists. For example, you could have
source=facebook-ad to track who is taking action from your sponsored post.
Note: When you create your source code, make sure to only use allowed characters (alphanumeric, underscores, and dashes). Apostrophes and other punctuation cannot be used.
More on source codes here.
Referrer codes are used to collaborate with organizations and build your lists using the same action. Each user and group on Action Network has a unique referrer code that is accessible from an action's thank you page. Anyone who clicks the link with your referrer code on it will be added to your email list, as well as the email list for the action's sponsoring organization. Referrer codes are also used for additional sponsors tool.
Note that you cannot create your own referrer codes. Referrer codes are generated on an action's thank you page or manage page and are unique for each group and individual user.
More on referrer codes here.
By default we recognize users who have taken action on Action Network before. Instead of having to fill out information such as their name, email address, and ZIP code again, they'll be welcomed back and can take action on the form more quickly. To force a widget to show the blank form fields instead of recognizing users, add the
clear_id=true URL argument to your widget code.
Note: Use the
no_rewrite=true URL argument when using this feature.
More on clearing a recognized user here.
You can pre-fill any input on Action Network pages or widgets by using URL arguments corresponding to the HTML name of the input. This is especially useful for checkbox, radio button, and dropdown questions — for example, if you sent an email with buttons asking people to vote 'yes' or 'no', you could pre-fill the option if that button was clicked.
This can be used for all questions, including core fields. For example, if you wanted to pre-fill a user's first name on a petition, you'd use the URL argument
signature[first_name]=. If you have a custom field question for someone's favorite ice cream, you'd use the URL argument
More on pre-filling input values here.
You can pre-fill the amount that someone donates on your fundraising page by appending
amount=X to your URL. This donation amount will automatically be selected when someone goes to your fundraiser.
More on pre-filling donation amounts here.
period=recurring_monthly OR period=recurring_weekly OR period=recurring_quarterly OR period=recurring_annually
You can pre-fill the recurring setting on your fundraising pages. You can set the donation to automatically recur monthly, weekly, quarterly, or annually.
More on pre-filling recurring options here.
By default our mass email tool adds identification, source codes, and referrer codes onto all your links in order to track activists. If you would prefer us not to, or are using the
clear_id=true URL argument, you should append
no_rewrite=true to the end of your links.
More on disabling link tracking here.
After someone signs an action, you can redirect activists to another page or website based on a URL argument instead of the page's built in settings (either our built in thank you page or a redirect to another web page). This allows you to redirect different activists to different places after signing the same action.
Note: Make sure to encode your URL! Here's one we like.
More on URL-based redirects here.
By default, every subscription option on action forms and widgets are checked, so users are subscribed to all possible lists — such as the action creator, the sponsoring group, and any referrer code used — when they take action.
If you want to uncheck one or all of those boxes by default, you can use this URL argument.
More on managing default subscription options here.
Examples of using multiple URL arguments on Action Network
Our URL arguments follow standard URL practices — meaning the arguments are appended to the end of the URL, after a
? . For example, a link to my fundraiser with the source code 'facebook ad' appended would look like this:
You can add many arguments to a URL by linking them together with a
& symbol. Scroll through this table to see how to add two URL arguments to a link:
Your end result is:
Let's go through a few more examples.
1. Tracking source codes and tracking referrer codes on a petition
I start out with my URL https://actionnetwork.org/petitions/make-voting-day-a-federal-holiday and add a question mark to indicate where the URL arguments start. I want to track who is taking action from clicking the link in this help document, so my source code is source=URL-arguments-doc . I add the source code to my link, so it becomes: https://actionnetwork.org/petitions/make-voting-day-a-federal-holiday?source=URL-arguments-doc
I also want to add my other group's referrer code. So I'll first add an ampersand, the link becomes https://actionnetwork.org/petitions/make-voting-day-a-federal-holiday?source=URL-arguments-doc& . Then I'll get my referrer code from the thank you page of the petition, and copy it: referrer=group-amys-test-group. So the entire URL is: https://actionnetwork.org/petitions/make-voting-day-a-federal-holiday?source=URL-arguments-doc&referrer=group-amys-test-group
2. Tracking referrer codes and redirecting activists from a Thank You page to a fundraiser on a petition
I am a co-sponsor in a joint action and want to send my signers to my donation page after they sign. I'll first get my link with the referrer code from the action manage page of the petition: https://actionnetwork.org/petitions/make-voting-day-a-federal-holiday?referrer=group-amys-test-group
Then I'll add an ampersand and decide where I want people to be redirected to after they sign. I want them to go to my fundraiser that has a source code source=petition: https://actionnetwork.org/fundraising/donate-to-day-of-democracy?source=petition
I go to this encoder and paste in the link to my donation page. It outputs https%3A%2F%2Factionnetwork.org%2Ffundraising%2Fdonate-to-day-of-democracy%3Fsource%3Dpetition
I'll then form my redirect argument, which looks like redirect=https%3A%2F%2Factionnetwork.org%2Ffundraising%2Fdonate-to-day-of-democracy%3Fsource%3Dpetition
The final link looks like this:
3. Pre-filling donation amount and pre-filling recurring period on a fundraiser
I want to put a link in my email that automatically pre-fills the donation amount and recurring period of my fundraiser. I'll start with a link to my fundraiser: https://actionnetwork.org/fundraising/donate-to-day-of-democracy
Then add a question mark to indicate where the URL arguments begin: https://actionnetwork.org/fundraising/donate-to-day-of-democracy?
Then add in the argument for amount. I want people to automatically donate $5, so my argument looks like amount=5 . I'll add that to my URL, so it now looks like this: https://actionnetwork.org/fundraising/donate-to-day-of-democracy?amount=5
I want to add a second argument, so I add an ampersand. Then I want the donations to recur weekly, so I'll add the argument period=recurring_weekly. The final URL looks like this:
Please make sure to test your links!