Installation is a developer task. Send them the In-app surveys SDK guide. The Installation tab in GainTrace also gives them copy-ready code for their server and browser.
Before you start
- The survey must be Active and Enable in-app collection must be on, with your product origin allowed. This applies to test mode too. You can save settings on a draft, but nothing shows until it is active.
- Your developer tells GainTrace which signed-in customer is looking at the page, so GainTrace knows which person and Company is answering. The survey is never shown to someone GainTrace can’t identify.
- Use the survey’s Rules tab for the settings below. Turn on Enable in-app collection when you are ready, then choose Save in-app settings.
Choose an install method
In the survey’s Installation tab, your developer chooses one of two ways to identify the signed-in customer.Signed token
1
Create an identity key
An admin opens Settings > Surveys, or Sending and identity at the top of the Surveys page, and chooses Create key under In-app identity. GainTrace shows the secret once, so copy it then. Keep it on your server and never put it in browser code.
2
Sign a token for each signed-in person
On your server, sign an HS256 token with that key. Put the key’s id (it starts with
gtk_) in the token header as kid. Set sub to your user id for the person, which GainTrace matches to the person’s external id and then to their email. You can add the email and company claims. Set exp no more than 24 hours ahead, and sign a fresh token each time the page loads.3
Install the script in the browser
Load the survey script, call
GaintraceSurveys.identify(token) and then GaintraceSurveys.show({ survey }). Call GaintraceSurveys.reset() when the person signs out.script-src, frame-src and connect-src, and also your custom survey domain if you use one, because the survey follows the address the script loaded from. Browser calls from origins other than the ones you allowed for the survey are refused. For all calls, claims and error codes, see the In-app surveys SDK guide.
When a survey is closed, or in-app collection is turned off, identify answers that the person isn’t eligible and nothing shows. GaintraceSurveys.reset() removes a survey from the page without recording a dismissal. The script’s own destroy() and the survey’s Close survey button do record one.
Backend session
Your server asks GainTrace for a session for one person at one Company and returns it to the browser. The browser snippet in the Installation tab sends the page address to your server as aurl parameter, and your server passes it to GainTrace. If you use page rules and it doesn’t, the rules can’t match and the survey doesn’t show. Event and time triggers aren’t available with this method. See the SDK guide.
Rules you set
A banner or corner card leaves the page usable, so people answer when it suits them. Centered blocks the page until they answer or close it. A banner or corner survey doesn’t take focus from where the customer is working. When it opens, screen readers hear “Feedback survey opened at the end of this page.”, and closing it returns focus to where it was. The centered survey takes focus.
Asking less often
Every in-app survey offers two buttons:- Ask me later hides the survey for a day.
- Close survey counts as a dismissal. No in-app survey shows to that person again until your workspace’s rest period passes (7 days by default). Set it in Survey rules.
- The survey’s cooldown, set in Branding and privacy, applies across surveys that measure the same thing, across email and in-app.
- Your workspace frequency rule applies to every channel.