- 19 Jun 2025
- 8 Minutes To Read
- Print
- DarkLight
- PDF
Fetch and process information for user Identification
- Updated On 19 Jun 2025
- 8 Minutes To Read
- Print
- DarkLight
- PDF
Overview
It’s necessary to identify your users to show relevant content. When creating a custom rule to identify a user or language in your application, you need to define the following:
Where does Whatfix get the unique identification data from?
How can Whatfix read data?
Note:
For more information about privacy and compliance, see Whatfix Privacy Policy.
A Sequence is a single set of instructions that Whatfix uses to capture and identify data for a custom rule. Within this sequence, the fetcher is responsible for retrieving or capturing the necessary data from the application. The processor then takes this fetched data and analyzes or interprets it to extract the relevant information for the rule.
The fetcher enables you to select from where you want to pull the value that defines the rule. For example, if each user has a unique identifier based on the cookie value, select From Cookie as the fetcher.
The processor enables you to parse the fetched value using JSON or String Operations.
Note
Add multiple processors to parse the fetched value. Click + Add Processor to add another parsing method.
Click + Add Sequence to add more identifiers to fetch a different value and parse it for another unique identification rule.
Capture information using Fetcher
Whatfix enables you to fetch data from various sources. Uniquely identify a user based on what works best for your application. Whatfix then displays analytics data based on User id, segment content for specific groups of users, identify users for Cohorts, and more.
Based on your requirements, pull identification values from different sources using the following fetcher options:
Fetcher option | Description | ||||||
---|---|---|---|---|---|---|---|
Fetch Cookie | Retrieves data from browser cookies. For example, if your application stores user id in the user_id cookie, enter user_id as the Key of the cookie from where you want to pull the value. | ||||||
Fetch Element Attribute | Retrieves data from attributes of HTML elements. Based on your requirements, choose a Selector Type (CSS or jQuery), enter Selector Value, Index, and Attribute Name. For example, a Save button on the Salesforce Lightning page has the following Selector Type and Selector Values:
| ||||||
Fetch from Local Storage | Retrieves data stored in the browser's local storage. In the Key section, enter the value you want to retrieve from local storage. For example, if your application stores user role data in the local storage as user-role, enter user-role as the Key from where you want to pull the value. | ||||||
Fetch from Session Storage | Retrieves data stored in the browser's session storage, which is similar to local storage, but the data is stored for the duration of the browser session. In the Key section, enter the value you want to retrieve from the session storage. For example, if your application stores session usage data in the local storage as section-count, enter session-count as the Key from where you want to pull the value. | ||||||
Fetch Element Text | Retrieves text data from attributes of HTML elements. Based on your requirements, choose a Selector Type (CSS or jQuery), enter Selector Value, and Index. For example, consider that you have a CSS selector called data-username that contains each users’ name that is stored at the 2nd index position. Set Selector Type as CSS, Selector Value as data-username, and Index as 2. | ||||||
Fetch from URL | Retrieves information directly from the URL. For example, if your URL is https://whatfix.com/user/123, Whatfix retrieves the entire URL. | ||||||
Fetch from URL Hostname | Retrieves the hostname from the URL. For example, for the URL https://subdomain.whatfix.com/path, Whatfix retrieves subdomain.whatfix.com. | ||||||
Fetch from URL Hash | Retrieves data from the URL hash. For example, if your URL is https://whatfix.com/page#section1, Whatfix retrieves section1 from the URL hash. | ||||||
Fetch from URL Path | Retrieves information from the URL path. For example, for the URL https://whatfix.com/user/123, Whatfix retrieves /user/123 from the URL path. | ||||||
Fetch from URL Parameter | Retrieves data from a specific parameter in the URL. For example, if your URL is https://example.com/page?param1=value1, and Whatfix can retrieve the value associated with the key param1 (i.e., value1). | ||||||
Return Value of Function | Enables the execution of a custom function, and the return value is used as the identification value. In the Function Name section, enter the JavaScript function whose return value you want. For example, you can have a JavaScript function getUserLogin() that returns a true or false value based on whether the user is logged in. | ||||||
Window Variable | Retrieves data from a variable stored as a Window Variable. In the Key section, enter the name of the Window Variable. |
Parse captured information using Processor
Whatfix enables you to process the raw data obtained from the fetcher and extract the relevant information needed for your custom rule. The processor provides options for performing actions such as parsing JSON and applying string operations.
JSON Operations
If your fetched data is in JSON format, the processor can be configured to extract specific values from the JSON structure. Use JSON Operations when the data you need is nested within a larger JSON object.
Whatfix enables you to use the Read Key JSON operation, which means that the processor enables you to extract a specific value from a JSON structure based on a given key. Here's an example Sequence,
Fetch JSON data representing a user profile:
Where do you want to fetch the user from?: Fetch from Local Storage (assuming the JSON data is stored in local storage)
Key: user_profile_data
Extract the user's email address from the fetched JSON object:
How do you want to process it?: JSON Operations
JSON Operations: Read Key
Select JSON: Output of Fetcher
Key Name: user.email
The JSON structure might look like: {"user": {"name": "John Doe", "email": "john.doe@whatfix.com"}}. The processor is set to read the key user.email
to extract the user's email address.
The processed result would be john.doe@whatfix.com. In the preceding example, the fetcher retrieves the JSON data from local storage under the key user_profile_data. The processor is then configured to read the key user.email
from the JSON structure, resulting in the extraction of the user's email address.
String Operations
If your data is in a string format, the processor enables you to perform string operations to extract the relevant information. Such actions include like splitting a string, finding a substring, and more.
Based on your requirements, you can process your data using the following String Operations:
String Operation | Description |
---|---|
Join | Concatenates multiple strings into a single string. For example, if you want to add a specific string before the fetcher output:
|
Split | Divides a string into an array of substrings based on a specified delimiter. You can also use the Index to specify which part of the split result to select. For example, you want to extract only the email address from a long string,
|
Substring | Extracts a portion of a string based on the specified start and end positions. For example, you want to extract only the first 4 letters of the user name from a long string,
|
To Lowercase | Converts all characters in a string to lowercase. For example, you want to convert the entire output to lowercase:
|
Trim | Removes leading and trailing whitespaces from a string. For example, you want to remove any extra space preceding
|
Examples: Processing and Segmentation
Read the following section to learn how you can use the fetcher options to identify users and segment Whatfix content.
Expand the following accordions for more details.
Fetch Cookie Value
Use the Fetch Cookie option when you want to retrieve data from browser cookies. For example, you can identify a returning user based on a last_visited
cookie. By fetching the value of this cookie, you can segment your Whatfix content to display a What's New pop-up or a personalized welcome message to returning users, helping them quickly get up to speed with any updates or changes since their last visit.
Fetch from Local Storage Value
Use the Fetch from Local Storage option to retrieve data stored in the browser's local storage. For instance, your application enables users to temporarily dismiss certain informational banners or announcements. When a user clicks Dismiss, you might store a flag in local storage called announcement_dismissed: true
.
Add the following as a Sequence in User Identification:
If the announcement is about a new feature, and the user dismisses it, you can trigger a Beacon that redirects users to the release notes of your application. The beacon is not very intrusive and the user can learn more about the feature at their own pace while mildly nudging them.
Here’s an example Visibility rule:
Fetch from Session Storage Value
Use the Fetch from Session Storage option to retrieve data stored for the duration of the current browsing session. For example, you might assign a temporary session_id to track a user's progress through a multi-step process. By fetching Session ID, you can display Whatfix Pop-ups to offer contextual help in the process where users spend more that the optimal time to complete a step or drop-offs in the process.
Here’s an image that displays the fields that you can add to fetch the browsing time:
Fetch Element Text
Use the Fetch Element Text option to retrieve the text content of a specific HTML element on the page. If a button's text changes to Saving... during an operation, you can fetch a particular text. Consider that you have a CSS selector called <div id="statusMessage">
that contains the value of button status in the 3rd index position.
Add the following as a Sequence for identification:
You can then use a Launcher to prevent further user interaction until the button text changes back to Save.
Here’s an example Visibility rules setting for When does the launcher start appearing?