In Sprig, Events are used to Trigger a Study. They cause your Study to be displayed to the user. All Web and Mobile studies require an event as a Trigger. Events can also be employed as an audience Filter, allowing you to refine further who is eligible to respond to the Study.

An Event is an action or occurrence in your website or application that allows you to track your users' behavior. Examples of Events include:

  • Visiting a page
  • Clicking or interacting with a button
  • Scrolling to a specific point on a page

How to determine what kind of event you need?

Sprig offers several different solutions on ways to deploy events in your environment. Deciding what kind of event to implement is dependent on study requirements and technological factors:

  • What kind of action is it? Is it in a simple UI action like clicking a button or some higher-level concept like signing up for a new subscription? A No-Code event might support simple UI action but might not support a more complex semantic.
  • What platform do you intend to launch your Study? Web studies support No-Code events, but mobile studies do not. Email and Shareable Link studies do not support events.
  • How good are your coding skills, and do you have access to the code? You may have to rely on a developer to implement your event, or you may have access to GTM or other integration and not depend on a developer.
  • Is it an event or an attribute? For example, do you want the Study to be triggered when the visitor completes the new subscription action, or would you like it to occur at a different time and only study those customers who have recently enrolled in a new subscription?

You could use two example workflows to determine what event type you need for Web and Mobile studies.

897897 897897

Where You Can Use Events

Configuring Trigger and Filtering events are supported in the Sprig Application (No-Code), the Web and Mobile SDKs, Google Tag Manager, and mParticle. Segment can be used to Trigger Web Studies and coming soon Mobile studies. The API only supports events for filtering. CSV Import does not support events.

Event Type

Trigger

Filter

Sprig Application (No-Code)

:white-check-mark:

:white-check-mark:

Web SDK

:white-check-mark:

:white-check-mark:

Google Tag Manager

:white-check-mark:

:white-check-mark:

Mobile SDK

:white-check-mark:

:white-check-mark:

API

:x:

:white-check-mark:

mParticle

:white-check-mark:

:white-check-mark:

Segment Actions

:white-check-mark: (JavaScript Only)

:white-check-mark:

Segment Classic

:x:

:white-check-mark:

Adding Events

Web and Mobile studies require events to track user behavior to display studies at the appropriate moment. Email and Link studies do not require events because they are delivered to respondents asynchronously. You can configure Sprig to listen for or receive events in two ways; either:

  1. Using the Sprig app, or
  2. Directly in the Website or App code where you launch your studies.

Events configured through the Sprig app are No-Code events. Events configured in the Website or App where you want to launch your studies are Code events.

The section describes the steps to add a No-Code and Code Event to Sprig

No-Code Event

No-Code events provide a way to configure Sprig to trigger Web studies without having to edit the source code on the server. No-Code events only support deploying Web-based studies. Code events may be used for web and Mobile studies using the appropriate SDK, API, or Integration.

No-Code events provide three different selection methods by which you can identify when an event occurs:

  • Page URL - this fires an event when the browser views a particular page you specify by typing in its URL.
  • Inner Text - an event fires when an element in a page containing the exact text specified, such as a button label, is clicked.
  • CSS Selector - an event fires if an element in a page is clicked containing the CSS label specified.

📘

Info

No-Code events are triggered when a specific condition is met (for example, when the current page URL matches a string you have defined). On page load, the system triggers the first event that matches that specific condition. If you have other No-code events with that same trigger condition, the system will not trigger those other events.

The steps to add a No-Code event are:

  1. Choose a page or a button on your website or web application.
  2. Keep that page open as you navigate to the next step; you're going to need to copy information from this page into the Sprig app. You may want to open the browser Inspect window if you intend to use the CSS selection method.
  3. In the Sprig Navigation Pane, click Events.
  4. Click Add Event.
  5. Click Create No-Code Event.
  6. Click Page URL based on browser page viewing or Inner Text for a trigger based on a button, link, or UI element event on the page, else CSS Selector to select the class.
  7. In the Display Name field, enter the Event name.
  8. In the Description field, enter the Event description.
  9. In the URL field, enter the Page URL string that you want to match. Once you have entered the string, enter the URL you are trying to match in the Test Your Event field and click Test Match to test if the string you entered matches the URL. For more information on page URL matching click here.
  10. Enter the URL you are trying to match in the Test Your Event field and click Test Match to test your URL pattern.
  11. If Page URL was selected, click Add Event.
  12. If Inner Text or CSS Selector was selected, enter the appropriate text or CSS to identify the element.
  13. Open your browser's JavaScript console in your browser
  14. Make sure you are on the correct page
  15. Paste the code snippet into the console and hit Enter.
  16. If successful, the element information will be displayed in the console.
  17. Click Add Event.

Testing the Event

  1. In your browser, perform the user behavior to generate the event.
  2. Click Reload Browser Reload to refresh the Events page contents.
  3. In the Events page, hold the pointer over Daily Usage. You should see that an event has been received.

Code Event

Code events may only be used for Web and Mobile applications. There are two ways to add events to Sprig: create the Code Event in the Sprig app, or have your developer send an event from the SDK.

Proactive

If you use the Sprig app to create a Code event, a code snippet is generated with the matching SDK parameter that you can give to your developer to incorporate into their code.

  1. In the Navigation Pane, click Events.
  2. Click Add Event.
  3. Click Create Code Event.
  4. In the Key field, enter the Event name. The Event name must match the same SDK parameter you are using to track the event.
  5. Click Use Key as display name. to use a different string to describe the event instead of the Key label.
  6. In the Description field, enter the event description.
  7. Click Add Event. You’ll be directed to the Events page.
  8. Locate and Select the Event you just created.
  9. Click Configure to Toggle between JavaScript, iOS, or Android to see the snippet that your engineers will need depending on which study delivery platform you’re planning to use the Event on and share that snippet with engineering. Direct them to the Connect section of the docs for more information on that specific platform, as well as how to locate the Environment ID.

Reactive

  1. Once your engineering team has sent a new event to Sprig, you will need to approve the request. You should see a banner similar to the following:
11161116
  1. In the Navigation Pane, click Events.
  2. Click Manage Requests.
  3. Click the check box next to the event(s) and click Approve.
  4. Click X to close the window.

📘

Info

You must Approve of an Event Request before it can trigger a study.
If you Deny an Event Request, it will be removed from the Event Request list. However, if Sprig subsequently detects that same Event Request, it will re-appear in the list.

Legacy Events do not have to be Approved.

Editing and More Info

  1. In the Navigation Pane, click Events.
  2. Click on the Event that you want to view.
  • The Display Name and Description may be changed.
  • For No-Code event, the trigger interaction can be toggled between Page URL, InnerText and CSS. The Page URL pattern can also be edited.
  • For Code event, the Key cannot be modified as an external source generates it.

The Display Name updates the event label throughout Sprig; you can use it to provide a more readable label than Key.

Archiving

Archiving an event stops the Event, triggering studies. Events cannot be archived when associated with an active study. You will need to pause, archive, or complete the study related to that Event to archive the Event. You can unarchive a previously archived survey.

📘

Info

Unlike pausing a Study, archiving an Event also halts the MTU count.

  1. In the Navigation Pane, click Events
  2. Make sure the filter is set to Active Events.
  3. Click the check box next to the Event.
  4. Click Archive.
  5. Click Archive a second time when prompted.

Unarchiving

Similarly, if you want to restart using an event, you can unarchive a previously archived event.

  1. In the Navigation Pane, click Events
  2. Make sure the filter is set to Archived Events.
  3. Click the check box next to the Event.
  4. Click Unarchive.

Sorting

  1. In the Navigation Pane, click Events
  2. Click on the column header to sort the Events
  3. Click on the column header a second time to reorganize the sorting order of the Events

Filtering and Searching

  1. In the Navigation Pane, click Events
  2. Click Multiple Sources and select the source to view.
  3. Click Active or Archived to select which events to view.

📘

Info

If you select Web No-Code Events as a source to view, if present, events from Segment Web and Google Tag Manager sources will also be included.

Inspecting and Diagnosing

  1. In the Navigation Pane, click Events.
  2. To learn more about how often the event is firing, hold the pointer over diagnostics diagnostics in Usage.
  3. If the diagnostics is grey diagnostics, your event is either not added correctly or has been turned off from your website, web application, or mobile application.
  4. If the diagnostics is green diagnostics, your event is being tracked and is available for triggering or filtering a study.
  5. The following tooltip will be displayed:
229229

Diagnostics Tooltip

If you are using other platforms, for example Segment or mParticle, they will also be displayed in the tooltip.

Do you have feedback about managing Events? Tell us more.