The Ultimate Guide To Embedded Analytics PDF 1711758041
The Ultimate Guide To Embedded Analytics PDF 1711758041
Embedded Analytics
Table of Contents
Introduction 2
Build vs Buy 3
Decision Criteria 4
Ways to Embed 7
External Embedding 9
Conclusion 30
1
Introduction
In the age of digital transformation, data's importance has grown exponentially.
Enterprises, regardless of their size, face increasing demands from customers seeking
access to their data. Historically, businesses have responded by establishing "customer
portals" facilitating secure access to a self-service analytics environment. In today's
dynamic market, providing such a service is no longer just an added benefit—it's a
necessity.
At its core, embedding involves integrating one software application with another.
Everyday examples include watching an embedded YouTube video on social media or a
blog post. Sigma can securely embed your dashboards within any application, enhancing
user accessibility and experience.
Although some entities still rely on "data dumps" or emailing data sets, these methods are
increasingly perceived as archaic, insecure, and inefficient.
This white paper aims to provide an in-depth overview of the various aspects to consider
when integrating a customer-centric analytics solution into your online platforms and a
demonstration of how embedding works in Sigma.
2
While the advantages are evident, many organizations either don't offer analytics portals
or have limited, static versions that lack interactive depth. When businesses consider
introducing or enhancing a customer portal with analytics, they face the critical decision
of building in-house versus purchasing a ready solution.
Build vs Buy
The decision to either build an in-house analytics solution or purchase an existing one
often arises when a business identifies the need for advanced data analytics for its
customers. Whether you already have an in-house solution that's proving challenging to
maintain, or you're starting fresh and seeking the most efficient route, it's vital to
continually assess both the time and monetary investments involved.
The build vs buy decision isn't novel; it has been a topic of discussion for years, with
businesses weighing the pros and cons of each option. The crux of the decision hinges on
the following considerations:
Opportunity Cost
Pros of Buying: Over time, investing in a pre-built Business Intelligence (BI) tool may
prove more economical than dedicating resources to build one from scratch. Choosing the
right BI tool can also liberate your developers, allowing them to concentrate on other
pressing projects.
Pros of Building: Creating a bespoke solution can cater to your unique business needs,
ensuring that every feature aligns with your specific requirements. However, this can
often come at a higher upfront cost and longer development timeline.
Maintenance
Pros of Buying: Purchasing a solution, especially a cloud-based Software as a Service
(SaaS) offering, can alleviate much of the maintenance burden. Such platforms generally
offer regular updates, security patches, and support, ensuring a seamless experience
without extensive input from your team.
3
Pros of Building: On the flip side, building your solution allows for tailor-made
maintenance schedules and patches specific to your business's needs. But remember,
everything you build requires dedicated support, which might strain your resources.
Pros of Building: Building your analytics solution grants flexibility. As your business grows
and needs change, you have direct control over adjustments and improvements. However,
swift adaptation requires constant vigilance and can be resource-intensive.
Summary
The decision to build or buy hinges on a business's specific needs, resources, and
long-term vision. Both paths offer advantages and challenges. It's crucial to make an
informed decision, considering not only the immediate requirements but also the future
evolution of your analytics needs and the broader business landscape.
Decision Criteria
In the burgeoning world of Business Intelligence (BI), numerous tools offer embedding
capabilities. As a decision-maker looking to seamlessly integrate dashboards into your
application, the variety of options can be daunting. However, insights from Sigma
customers reveal some critical themes that underscore why Sigma stands out for
embedding:
Ease of Implementation
Sigma's setup process is refreshingly straightforward. By employing an iFrame and
constructing a server-side API, integration is accomplished effortlessly. Sigma even offers
API samples across popular programming languages, with tasks like customizing the user
4
experience integration managed by the API itself. On average, this setup process can be
completed within a day.
Performance
The user experience hinges on performance. Rapid response times during data drilling or
filtering processes are essential. Traditional BI performance remedies, such as in-memory
or on-premise solutions, might offer solutions but often at the expense of higher costs and
complexity. The more advanced approach? The Cloud Data Warehouse (or Lakehouse). It's
pivotal to select a BI tool specifically designed for CDWs rather than one merely adapted
to them.
Scalability
The ideal embedded solution should grant users access to comprehensive, fine-grain data
without restrictions like data aggregation or limited timeframes. This ensures that users
can engage in intricate, ad-hoc queries without hindrance, even if there are billions of
rows involved.
5
Security
Ensuring data exclusivity for each customer is critical. Through mechanisms like row-level
security (RLS), BI tools can ensure data exclusivity. Effective embedding solutions also
offer single-use URLs, enhancing security without demanding user authentication against
the BI tool.
Cloud-Native Orientation
Modern BI tools should be cloud-native, emphasizing aspects like scalability,
comprehensive functionality, and a modern feel. It's essential to avoid tools that may be
cloud-hosted but aren't cloud-native by design.
Interactivity
A high degree of user interactivity ensures better engagement. This includes features like
drilling down, filtering, sorting, and overall data exploration. For optimal interactivity, a BI
tool should possess a refined query execution model, supporting varied data exploration
techniques.
Summary
The desired characteristics of an embedding solution are multifaceted: it should be fast,
offer real-time data, guarantee top-tier performance, scale as required, maintain stringent
security protocols, ensure proper user authentication, operate natively in the cloud, and
6
provide a rich interactive experience. A holistic embedded solution, like the one offered by
Sigma, encapsulates all of these attributes.
Ways to Embed
The embedding method often varies based on the target audience or consumers of the
data. Typically, embedding needs can be categorized into three primary types:
Public Embedding
Purpose: Used when the data is intended for the public domain or isn't specific to a
particular company or individual.
Security: No stringent security measures are required since the data is not confidential.
How Sigma Supports: Embed the public link within an iFrame and the dashboard is ready
for public viewing.
Internal Embedding
Purpose: Designed for an organization's internal stakeholders, such as employees, and
offers specific access based on authentication.
Usage: Organizations use this to monitor various internal metrics and KPIs. For instance,
Sigma embeds dashboards within Salesforce to track business performance metrics like
sales pipelines, forecasts, and software adoption rates.
Authentication: Either a local account within the BI tool is created, or Single Sign-On
(SSO) via Security Assertion Markup Language (SAML) is employed.
Working Principle: When users access a dashboard, they can only view it if they are
authenticated against the BI tool. SSO is commonly used: Once users log into a portal
7
through SAML, the BI tool checks for authentication. If the Identity Provider (IDP)
confirms, users can access the dashboard.
Suitability: It is ideal for businesses that rely heavily on metrics to drive their strategies
and operations, especially when the users typically undergo SAML authentication.
External Embedding
Purpose: Designed for customers who log into custom-built portals, specifically crafted to
provide them with tailored data.
Appearance & Branding: These portals often bear the brand of the provider and are
seamlessly integrated into the services offered by them.
Authentication: With Sigma, the embed inherits the security from the parent application
at runtime, using whatever security mechanism the parent application used to grant the
user access.
User Experience: Ideally, customers shouldn't even discern that the dashboards are
embedded. The transition should be seamless, and the interface should be congruent with
the rest of the application.
Summary
Choosing the right embedding type hinges on your data's intended audience and the level
of access and security needed. A well-integrated and appropriately chosen embedding
type can offer a seamless and efficient experience for the end-users, enhancing their
interaction and trust in your application.
8
External Embedding
External embedding has emerged as the favored method for businesses that have bespoke
customer portals and wish to introduce or elevate their analytics offerings. For
organizations contemplating the incorporation of external embedding within their
customer portals, Sigma stands out as a leading choice.
Sigma is the first analytics and business intelligence solution tailored for cloud data
warehouses. It seamlessly combines a contemporary spreadsheet interface directly linked
to your cloud data warehouse, ensuring a real-time, immersive experience. Its platform
aligns with the critical requirements highlighted previously in the "Decision Criteria"
section.
9
Learn how to implement RLS
Versatility in Embedding
Choose between embedding entire dashboards or singular visualizations based on your
needs.
Customization
Sigma supports tailor-made layouts and themes to ensure visual cohesion with your brand
and portal.
Interactivity
Users can actively engage with the data through functionalities like drilling down, filtering,
and utilizing charts as controls, provided they have the appropriate role assignment.
Responsive Design
Sigma’s embedded dashboards are optimized for various devices, including mobile phones,
tablets, and laptops. The dashboards adjust dynamically based on screen size.
10
An illustrative example might be a tab-based interface where every tab displays a distinct
embedded dashboard. If a user sets a date range filter on one tab (e.g., “last 30 days”), that
specific date range can be carried over to the next accessed tab.
Numerous Sigma embeds clients utilize this functionality to transition filter values
between their portal modules and Sigma embeds. This integrated approach ensures a fluid
user experience, making the embedded BI component appear innate to the platform.
Summary
External embedding with Sigma offers a harmonized, interactive, and responsive analytics
experience. Integrating seamlessly with custom-built portals ensures that users derive
insights efficiently, enhancing overall user engagement and satisfaction.
11
How Embedding Works in Sigma
External embedding is made possible by the creation of a unique, encrypted, one-time-use
embed URL pointing to the workbook, workbook page, or element you wish to display,
along with any optional parameters you wish to include.
This URL is generated on the server side of your parent application through an API you set
up and is rendered client side in an HTML iFrame element.
The image above is a workflow that provides a high-level overview of the process. It is
very important to note that each API-generated URL can only be used once and if
modified externally and resent, it will generate an error message in the browser.
12
Step 1: Identify the content to embed
In Sigma, we will select a dashboard to embed. It does not matter which you select, but the
below dashboard is provided in the Sigma trial environment so that we will use it for
simplicity. Note that the red arrow indicates that the base dashboard shows all sales
regions. Later, we will use RLS to show only the east and west regions automatically.
13
Step 2: Share the dashboard
For this example, we will share the dashboard with the “FinanceViewers” team. To do this,
click on the caret next to “Sales Performance” (the title of the workbook), then click
“Share.” From there, select the person or team to grant access to. In this example, select
the “FinanceViewers” team, then click “Share.”
14
Step 3: Copy the embedding path
Next, we need to get the embed path (URL) from the dashboard menu. Again, go to “Sales
Performance” in the header, click the caret, then select “Embedding…”. A pop-up will
appear. Under the dashboard section, click “Copy” to the right of the embed path.
From there, we must use Sigma’s administrative panel to generate keys. These keys work
to establish a trust relationship between your application and your Sigma instance. Be
sure to copy the provided Client Id and Secret and store them, then click “Close.”
15
How to copy the Client Id and Secret.
Now that we have copied our embed URL and secrets, we can place and configure our
server-side API.
For this example, we will create a simple node.js project. This project will use JavaScript
for the API and embed it into a simple HTML page.
NOTE: The code and process details are available here if you’d like to explore this on your
own.
16
Step 4: Set Up the Node.js Express Server
Initialize the Server: Begin by creating the server.js file and initializing the Express
application. Import the required express and crypto modules at the start of the file.
Serve the Main HTML Page: Set up a route handler to serve your main HTML page when
the root URL is accessed.
Generate the Embed URL: Create an API endpoint that will handle the generation of the
embed URL, which includes security measures like nonce generation and signature
creation.
17
Insert the following code block at this point in your server.js file to define the /api/foo
endpoint:
Start the Server: Write the command to start the server, listening for requests on port
3000. You can confirm the server is running by checking for a console message.
app.listen(3000, () => {
console.log('Server listening on port 3000');
});
The server.js file should contain all the steps above, with the cleaned-up code
provided in the appropriate section to handle the /api/foo endpoint. This endpoint is
crucial as it constructs the secure URL needed to embed Sigma visualizations with the
proper parameters and security features in place.
18
Summary: You can find the entire code below:
19
Step 5: Match the values for your embed
In this step, you will update your server.js file to include the specific values for your
Sigma embed configuration. This ensures that the server generates a correctly formatted
URL that aligns with your Sigma setup and user requirements.
Set Embed Path and Secret: Replace the placeholder values for EMBED_PATH and
EMBED_SECRET with the actual values you have saved from your Sigma account setup.
Build the Search Parameters: Construct the search parameters by incrementally adding
the required details. This includes the client ID, user email, user ID, team, and account
type. The parameters must match the values expected by Sigma for successful embedding.
20
// Replace with the actual account type
searchParams.append(':account_type', 'Viewer');
Remember to replace the placeholder text with actual data specific to your environment.
In a production environment, the email and user ID should be programmatically retrieved
rather than hardcoded.
Complete the URL Construction: After appending all the necessary parameters, combine
them with the embed path to form the entire URL string. Then, create a secure signature
and append it to the final URL.
Send the URL in Response: Within the /api/foo endpoint, ensure that the final URL is
sent back in the response to the client.
Once you have updated these values, save the changes to your server.js file. Your server is
now configured to generate URLs that are matched to your Sigma embed configuration
and can be used to embed Sigma visualizations into your web application securely.
21
Step 6: Start the Node.js Express Server
With the configurations set, it's time to start the Node.js server and verify that the Sigma
embed is operational within your HTML page.
Launch the Server: Use the command line interface to navigate to the directory where
your server.js file is located. Start the server by running the following command:
node server.js
Server Initialization: Upon running the command, the server will initialize and start
listening for requests on the specified port (in this case, port 3000). You should see a
console output confirming the action:
Verify the Embed URL: The main HTML page should make a request to the /api/foo
endpoint to retrieve the embed URL. This will be used to set the src attribute of an iframe
that will display the Sigma visualization.
22
For reference, the HTML page code is as follows, with the iFrame code shown in red:
<html>
<head>
<title>Sigma Embedding - RLS</title>
</head>
<body>
<h2>Sigma Embedding - Row Level Security</h2>
<h3>iframe URL below comes from API call to server</h3>
<iframe id="sigmaDashboard" width="100%" height="90%"></iframe>
<script>
const URL = "http://localhost:3000/api/foo";
fetch(URL)
.then(data => {return data.json()} )
.then(res => {
document.getElementById("sigmaDashboard).src = res.url
})
.catch(e => console.log(e));
</script>
</body>
</html>
Embed Rendering: With the URL set, the Sigma dashboard should render within the
iframe. You'll see the embedded Sigma visualization on the page.
23
How an embed will look when running localhost:3000.
Note: The signature is a SHA256 hash of the secret and the final URL, with all of the
parameters.
24
Screenshot of the one-time URL.
Accessing the “inspect” mode of the browser, you will see a one-time URL.
25
If we inspect that URL, here is what we will find:
THIS IS THE TIME THE EMBED MAY LIVE BEFORE A NEW URL IS GENERATED:
&:session_length=600
">
</iframe>
26
Troubleshooting
● If the Sigma visualization does not appear, check the browser's developer console
for any errors.
● Ensure that CORS policies are appropriately handled if the request is made to a
different domain.
● Verify that the EMBED_PATH and EMBED_SECRET are correctly set in your
server.js file.
27
Enforcing Row Level Security
Next, we must govern the data individual users can access. We'll accomplish this through
Row Level Security (RLS) in external embedding.
Let’s assume we want our “FinanceViewers” to only access stores in the East and West
regions. Our data has a column (Store Region) that allows us to support this with RLS.
In Sigma, our example workbook has multiple tabs, with one tab (Data) acting as the
“source.” We are using this data to build dashboards and visualizations, querying the
warehouse once. There are a few different methods to apply a user attribute to Sigma
data:
1. Use the user attribute value that is passed in a custom SQL query as a condition in a
where clause. Since this involves writing some SQL, we probably want to avoid that
and let Sigma do the SQL work for us in the background.
2. Add a Sigma filter control to the workbook that is viewable by the creator, but
hidden from the average user.
3. Apply the user attribute directly to the source data as a function that drives the
column data, in this case, “Store Region.” This is the preferred method and will be
used in the following example.
Sigma’s API supports any value passed to a custom “user attribute” at runtime. By simply
adding a formula to the dataset, the API evaluates the new “user attribute” and filters the
data according to the value(s) passed. First, we need to add a new user attribute in Sigma.
We will call our user attribute “Region” and leave “Default Value” blank. This ensures that
no data will be shown unless the API passes a value for ua_Region.
NOTE: you can also assign user attributes to Teams or individual members. In this
example, we will use the user attribute directly.
28
Row-Level Security Example
To assign users to a user attribute, go to the Administration screen, then on the left select
User Attributes. You should be able to add a Region for row-level security. In the example
below, you will also be able to see Teams or Members assigned.
Next, go back to your data source, and add a new column to the source data on the data
tab called ua_Region.
29
The contains function in the new ua_region column.
30
Then add a filter against the new column, ua_Region, and select True. The result of this
will be a table with only the matching rows passed by the API for ua_Region.
31
Screenshot of the visualizations before leveraging row-level security.
Specify Embed Path and Secret: Assign the EMBED_PATH and EMBED_SECRET variables
with the values provided by your Sigma embedding setup.
32
Constructing the Embed URL: Begin building your embed URL by appending each
required parameter to the searchParams object.
// Append the external user ID, set to match the user's email for simplicity
// Replace with the external user ID
searchParams.append(':external_user_id', '[email protected]');
Incorporate User Attributes for Row-Level Security (RLS): To apply RLS, add the user
attribute ua_Region to the searchParams. The value for this should be the regions you
wish to include, separated by commas.
33
Finalize the URL: Combine the searchParams with the EMBED_PATH to form the
complete embed URL. Then, generate the secure signature and append it to the URL.
Save and Test: After updating your code, save the server.js file and refresh your
browser to test the changes. If implemented correctly, you should now see Sigma
visualizations reflecting data for all specified store regions.
34
Screenshot of the visualizations after leveraging row-level security.
https://app.sigmacomputing.com/embed/1-5QFPkoPbkjUHD2wzC8fLgl?:nonce=a0fc25ed
-7bc5-481b-b793-9272c9c48b2b&:client_id=b52989b07f20ac8f675fb9d9ef0db294a
a1858920844658ae2c852cbe17c8c8a&:[email protected]&:ext
ernal_user_id=12345&:external_user_team=FinanceViewers&:account_type=
Viewer&:ua_Region=East,West,South&:mode=userbacked&:session_lengt
h=600&:time=1696885437&:signature=1637ea9a037fe8f223bbaa0e0c1b09311c0
d5e0b0715d691c934a4bf86b0f9f0
35
Conclusion
Throughout this white paper, we explored different ways to embed visualizations while
navigating through various authentication mechanisms. The decision rests on configuring
your existing environment and your organization’s security goals.
Public Embedding
Offers an open, non-restricted view without security layers. It's akin to a public domain,
accessible to all without authentication barriers.
To try out Sigma’s embedded platform capabilities today, sign up for a free trial.
You can quickly connect to your data and be on your way to prototyping your new
embedding solution!
36