Guide to unique links for web forms

This support article is a supplement to our core documentation on using custom links to pass information into forms.

When using web forms, it’s common to send out links to the form, especially if anonymous access (no need for SurveyCTO credentials) is turned on. However, there may still be times where you would like to track respondents by sending them a unique link. When you create a unique link, the field "caseid" in your form is given a value based on that unique link. That field value can be used to track respondents, check for duplicates, and several other situations.

To learn how to create and use unique links, skip to how to create unique links below.

Use cases for unique links

Here are a few use cases for the above web form data collection strategies. This list is by no means comprehensive, so use unique links as you see fit.

Tracking respondents

Unique URLs can be used for tracking respondents during longitudinal studies. Instead of sending a follow-up form where a respondent has to find and enter what their unique identifier was (which they may have lost, or can't remember), you can send them a unique link that has the identifier already included. That way, when they submit their form, you can use the "caseid" to compare their answers to the baseline survey answers.

Checking for duplicates

Unique URLs are also a great way to make sure a respondent does not complete a form more than once, and also make sure they are not sharing that link. If they have you just have to check if any submissions share a "caseid" value. Just make sure each link sent out ends in a different unique identifier.

Different relevant fields

Even though we refer to "unique identifiers", they do not have to be unique to each respondent. What you can do is divide respondents into groups, and then make certain fields relevant only if the respondent is a member of a certain group. For example, if only members of group 1 should answer a certain field, you can make their unique identifier "group1", and give that field this relevance expression:

${caseid} = 'group1'

Of course, "group1" is a somewhat generic group name. It is great for randomized groups, but you can also be more specific. For example, each respondent in the state of Haryana can have a unique identifier of "haryana", and fields meant only for them can have this relevance expression:

${caseid} = 'haryana'

You can also give each respondent a unique identifier, and then attach a server dataset or CSV file that shows which categories they are a part of. For example, let's say in the server dataset called "cases", the unique identifier column is called 'id', and the respondent's home state is in the column called 'state'. When that dataset is attached to the form, you can have a calculate field called "state" with this calculation to return the state of the respondent using their unique identifier:

Let's say a respondent has the unique identifier ("caseid") of 1001. In the server dataset called 'cases', if the row with the unique identifier ('id') of "1001" has a 'state' value is "Haryana", then the above field "state" will return "Haryana". Then, you can include a field that is only relevant when that respondent lives in the state of Haryana:

${state} = "Haryana"

That way, you can track individual respondents, and also make sure only certain fields will be relevant to certain respondents. You can even use this method to assign multiple categories to a respondent. In addition to "State", you may also want to ask certain questions based on occupation, family status, and even responses to fields in previous surveys. You could also ask about these in the form, but sometimes, it is easier to pre-load that data. To learn more, check out our documentation on pre-loading data into a form, as well as this webinar.

How to create unique links

In SurveyCTO forms, there is a field called "caseid" (if you created your form from the SurveyCTO server console, this will be automatically included). Usually, this is used for case management to store the ID of the case, but you can also use it to create unique URLs to track respondents.

If you created your form definition spreadsheet from scratch, make sure you include a caseid type field. In your form definition, simply add a field called "caseid" of type caseid.

For example, if you go to the Collect tab of your SurveyCTO console, and click on the Share button for one of your forms, a URL will appear that looks something like this:

https://SERVERNAME.surveycto.com/collect/FORM_ID?caseid=

Do you see how it ends with ?caseid=? You can add a unique code after that, and as per the product documentation, that code will be the value of the field "caseid". For example, let's say a respondent is sent this link:

https://example.surveycto.com/collect/example_form?caseid=123abc

When a respondent opens a form from that link, the value of the field "caseid" will be 123abc, and you will be able to see that when you go to export your data.

Preventing duplicates with form publishing

If you would like, you can use an attached dataset to prevent respondents from completing the form more than once. You can do this by creating a list of unique identifiers in a server dataset, and then removing them as their forms are completed. Here is a brief overview:

  1. Create a server dataset with a list of all unique IDs that will be used in the survey, and attach it to the form.
  2. In the form, include a required note field that only appears when the unique ID is not in that dataset. Here is an example relevance expression for that note field:
    empty(pulldata('unique_ids', 'id_key', 'id_key', ${caseid}))
    That expression is only "true" when the value of the field "caseid" is not in the 'id_key' column of the dataset with the ID 'unique_ids'.
  3. Use form publishing to remove completed unique identifiers from the list. (It may take up to five minutes for the submitted form to update the dataset.)

For an example, check out the sample files in this folder (upload and deploy the form definition first, then the XML dataset definition, and then upload the CSV data to the dataset).

To learn more about pulling data from a dataset (or CSV file), check out our documentation on pre-loading data into a form, as well as this webinar. To learn more about form publishing, check out our documentation on publishing form data into server datasets, as well as this webinar.

Ensuring unique URLs are used

If you would like to take this a step further, you can add additional checks to make sure the case ID was not removed from the URL. For example, you can include a required note field with the relevance expression empty(${caseid}) with the label:

Warning: Please use the link you were given unmodified. Since you have already opened a version of the form, please open that link in an incognito/private browsing window. Thanks, we appreciate your participation!

Because SurveyCTO web forms use cookies to save a web form session ID, if a respondent opens a different unique URL to your form without completing the first form, the old "caseid" value will still be saved and used. This is why the example warning above mentions using an incognito/private browsing window, which does not use cookies.

Another way to ensure unique links are used is by branding your links. To learn more, check out our support article on branding your links.

Further reading

To learn how to quickly email these links to many respondents, check out our guide to sharing web form links via email.

To learn how to brand, redirect, and track your links, check out our support article on branding web form links.

Do you have thoughts on this support article? We'd love to hear them! Feel free to fill out this feedback form.

0 Comments

Please sign in to leave a comment.