# Link Builder

For situations where you can’t use the Pulse Insights code snippet to render surveys and collect data, you can use the Pulse Insights Survey Response API instead.

Pulse Insights integrates into email by placing clickthrough links that record the appropriate response along with other data such as the recipient’s userID. Then optionally, you can redirect the user to a page of your choice. If the page has a Pulse Insights tag, you can optionally collect additional information or just display a Thank You message that the response has been received.

The easiest way to get links is to create the survey/poll in the Console and then use the Link Builder tab to copy the clickthrough URLs.

While in the survey's Editor or Results page, click on the "**Link Builder**" tab at the top of the page.

<figure><img src="https://563760996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkJBdddbwa2Hgh4yTRC5g%2Fuploads%2FGjFCfxhJ7EseEs8UEG5m%2Fimage.png?alt=media&#x26;token=2105befa-aab3-4983-9394-1de090317dfd" alt=""><figcaption></figcaption></figure>

Survey responses are passed in the following format: ‍&#x20;

```
//survey.pulseinsights.com/q/[question ID]/a/[answer ID]?identifier=PI-XXXXXXXX 
```

{% code title="For example:" %}

```
//survey.pulseinsights.com/q/1234/a/9876?identifier=PI-99999999
```

{% endcode %}

### Capturing Free Text Responses

You can use the `text=` parameter to capture free text responses.&#x20;

{% code title="Free Text Example:" %}

```
//survey.pulseinsights.com/q/9999?identifier=PI-81960884&text=this%20is%20a%20response 
```

{% endcode %}

### Redirecting The User To Another Page Post-Submit

Use the `redirect` parameter if you want to configure a custom redirect URL. By default, it will redirect to the referrer if there’s any, otherwise, it will just display a thank you message.&#x20;

{% code title="Redirect Example:" fullWidth="false" %}

```
//survey.pulseinsights.com/q/1234/a/9876?identifier=PI-99999999&redirect=https%3A%2F%2Fyoursite.com
```

{% endcode %}

{% hint style="info" %}
Note: special characters should be encoded in the redirect so portion of the URL as shown above.
{% endhint %}

{% hint style="warning" %}
The domain of the `redirect` URL must be whitelisted. This is configured in the Console's [Global Targeting](https://docs.pulseinsights.com/account-level-settings/global-targeting#redirect-domain-whitelist).&#x20;

To Configure: Click "Settings", then "Global Targeting", scroll to "Redirect Domain Whitelist" and enter the domain(s), 1 per line. Click "Update" to save.
{% endhint %}

### Saving Custom Data with Responses Via API

Any other query string parameter will be saved as custom data within Pulse Insights. This is often used to store things like:

* The recipients userID so you can tie responses back to an individual
* Details of the email campaign such as name, campaign date, or whether it’s a test or production email drop.

{% code title="Custom Data Example:" %}

```
//survey.pulseinsights.com/q/1234/a/9876?identifier=PI-99999999&userID=5555&locale=us 
```

{% endcode %}

### Testing Surveys In Draft Mode Via API

You can use `preview_mode=true` if you want to test draft surveys. //survey.pulseinsights.com/q/1665/a/9163?identifier=PI-81960852\&preview\_mode=true&#x20;

{% hint style="info" %}
Note: Expired or Paused surveys won’t be able to collect data via API and will show an error message if attempted.&#x20;
{% endhint %}

### Showing Poll Results From Poll In-Email

If you’re asking a question in-email and want to show the results upon answering, you can append: `pi_poll=true` to the URL.&#x20;

This will force Pulse Insights to show poll results for the question.&#x20;

{% hint style="info" %}
Note: polls results only work for the first single choice question within a survey.
{% endhint %}

## Pro Tips:

* If a survey/poll is only intended for email, make sure that the targeting is configured to prevent firing on web or mobile.&#x20;
* You can append `pi_present=[thank you message ID]` in the redirect URL to force a thank you message or follow-up questions to appear on click.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pulseinsights.com/configuring-pulse-insights-console/editor/link-builder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
