Links and Analytics
This page covers how to link to Showpad assets and external URLs, use local storage for state persistence, and track usage with analytics.
What you'll learn
- How to link to assets, external URLs, and internal content
- How to use local storage to preserve app state
- How to track usage with Showpad SDK and Google Analytics
- Use
showpad://protocol for asset links - Use HTTPS for all external hyperlinks
- Do not use iframes for internal links; they will not work on iPad
- Use local storage to preserve user state between sessions
Links
| Link type | How to implement |
|---|---|
| Assets | Use <a href="showpad://file/{assetSlug}"> to link to an asset by its slug. |
| Hyperlinks | Use the <a href="{url}"> tag. Hyperlinks are loaded over the HTTPS protocol only. |
| Internal links | Do not use iframes for internal links; they will not work on iPad. |
Angular apps have <base href="/"> by default. Change this to <base href=""> to ensure files load properly.
Local storage
Use local storage to preserve app state between sessions. Users leave and return while maintaining their previous state: completed forms, selected language, and other settings.
Analytics
Showpad SDK
Track usage via the SDK's trackEvent function. See SDK Integration for details.
Google Analytics
To track HTML5 app usage, integrate Google Analytics 4 for detailed insights. Ensure all content is requested over HTTPS, as using HTTP scripts may prevent the app from loading in most browsers.
Add the following to your index.html <head>:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Replace G-XXXXXXXXXX with your GA4 measurement ID.
This example loads Google Analytics JavaScript from a third-party origin. The script runs with the page's privileges and may access page data. Assess the vendor and data exposure before use. HTTPS protects delivery but does not verify script contents. Use Subresource Integrity, a reviewed mirror, or another supported mitigation where your integration permits it.
Next steps
- URL Schemes - Link to Experiences, assets, and folders from your web app
- SDK Integration - Execute SDK functions from your HTML content
Was this page helpful?