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

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

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 Filters for a Study that allows you to further refine who is eligible to respond to the Study.

How to determine what kind of event you need?

Deciding what kind of event to implement is dependant on several study requirements and technological factors:

  • What kind of action is it. For example, 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 meaning.
  • What platform do you intend to launch your study on? 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 have to 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?

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

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. The API and Segment only support 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

:x:

:white-check-mark:

Adding

Web and Mobile studies require events to track user behavior in order 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 using the Sprig app or 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.

📘

Info

You can only use No Code events for Web-based studies. Code events can be used for both Web and Mobile studies using the appropriate SDK, API, or Integration.

For convenience, you may optionally add a reference to a Code event in the Sprig app by giving it a Name and a Description. Perhaps you want to launch a study to collect responses as soon as the first Code event is received from the Website or App. In that case, the reference to the Code event in the Sprig app must have the same name as in the target Website or App otherwise, and the Code event will appear as an additional event on the Events page and fail to trigger the study. This reference is not a required step as any Code event correctly configured in your Website or App will automatically appear on the Events page.

No Code Event

A No Code event provides a way to configure Sprig to listen for events for Web studies without having to edit the source code on the server.

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 that you specify by typing in its URL.
  • Inner Text - an event fire 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 specified.

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 app Navigation Pane, click Events.
  4. Click Add Event.
  5. Click No Code.
  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 to select the class.
  7. In the 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 Save.
  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 Save.

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. If you use the app to create a Code event reference a code snippet is generated 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 Code Event.
  4. In the Name field, enter the Event name. The Event name must match the same SDK parameter you are using to track the event.
  5. In the Description field, enter the Event description.
  6. Click Save. You’ll be redirected to the Events page.
  7. Locate the Event you just created.
  8. Select the Event row.
  9. 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.

Web SDK, Google Tag Manager or mParticle

Sprig provides the ability to add an event that can be used as a Study Trigger or Filter through the Web SDK, Google Tag Manager and mParticle and describes this as an Event Type called Code.

When using the Web SDK, Google Tag Manager or mParticle you can also use the Sprig UI to add an event type called No Code. The No Code event type provides support for three different types of triggering and filtering described as Page URL, Inner Text and CSS Selector. To learn more about No Code events, please visit No Code via the UI

Mobile SDK

Sprig provides the ability to add an event that can be used as a Study Trigger or Filter through the Mobile SDKs and describes this as an Event Type called Code.

Sprig API and Segment

Recall that events are used as both a Study Trigger as well as a Filter. In the case of the API and the Segment integration, if you add or create an event via the API or Segment it can only be used as a Filter. A study's filter is used to further target a cohort of users on a given study, as opposed to triggering the study.

📘

Info

Segment events can only be used as study filters in Sprig, not study triggers. Because Segment events can be received on a delay and do not guarantee a real-time interaction with your visitors, they cannot be used to trigger a study. Sprig continues to press for this capability directly with Segment on your behalf and we'd encourage you to contact them as well. The Sprig/UserLeap SDK needs to be installed on your web or mobile application and should handle any trigger events for studying within your product. You typically only need 3 - 5 events for 80% of your studying needs.

Editing

  1. In the Navigation Pane, click Events
  2. Click the three ellipses on the Event that you want to edit
  3. Select Edit

📘

Info

For No Code event, the event Name cannot be edited. The Name is considered unique and must be reserved. The trigger interaction can be toggled between Page URL, InnerText and CSS. The Page URL pattern can also be edited.

📘

Info

For Code event, the event Name cannot be edited. The Name is considered unique and must be reserved. Only the Description of the event can be modified.

Deleting

Deleting an event is a permanent action, and it cannot be recovered. Events cannot be deleted when associated with an active study. You will need to pause, archive, or complete the study that is associated with that event in order to delete the event.

  1. In the Navigation Pane, click Events
  2. Click the three ellipses on the event that you want to edit
  3. Select Delete
  4. Select Delete a second time when prompted.

Viewing

  1. In the Navigation Pane, click Events

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. Navigate to the input field, begin typing a value to filter or search for the filter

Inspecting and Diagnosing

  1. To learn more about how often the event is firing, hover over the diagnostic icon in the Daily Usage column.
  2. If the diagnostic icon is grey, your event is either not added correctly or has been turned off from your website, web application, or mobile application.
  3. If the diagnostic icon is green, your event is being tracked and is available for triggering or filtering a study. As it is tracked it is then enumerated by hours, days, and weeks.

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