Project updates from Template #1
+3
-3
@@ -194,9 +194,9 @@ Next steps:
|
|||||||
- $W/Resources/Static/site.webmanifest (name / short_name)
|
- $W/Resources/Static/site.webmanifest (name / short_name)
|
||||||
2. Set a real database password in a git-ignored $W/.env
|
2. Set a real database password in a git-ignored $W/.env
|
||||||
(the committed .env.local defaults the password to the slug — do NOT ship that).
|
(the committed .env.local defaults the password to the slug — do NOT ship that).
|
||||||
3. Analytics ships OFF, and stays off until you opt in. To enable it: point
|
3. Analytics ships OFF, and stays off until you opt in. To enable it: check
|
||||||
String.Analytics.origin at your own Umami instance (it defaults to the
|
String.Analytics.origin (it defaults to the platform instance at
|
||||||
reserved https://analytics.example.com), allow that origin in
|
https://analytics.rock-n-code.com), allow that origin in
|
||||||
security.contentSecurityPolicy, then set ANALYTICS_WEBSITE_ID.
|
security.contentSecurityPolicy, then set ANALYTICS_WEBSITE_ID.
|
||||||
4. Point the git remote at your new repository:
|
4. Point the git remote at your new repository:
|
||||||
git remote set-url origin <new-repo-url> # or 'git remote add origin ...'
|
git remote set-url origin <new-repo-url> # or 'git remote add origin ...'
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ See [Persistence](#persistence-1) below for the workflow.
|
|||||||
### Analytics
|
### Analytics
|
||||||
The template ships analytics **off**: `analytics.websiteID` is empty, so both pages embed no tracker at all and no third-party script is requested. Enabling it takes three steps, in this order:
|
The template ships analytics **off**: `analytics.websiteID` is empty, so both pages embed no tracker at all and no third-party script is requested. Enabling it takes three steps, in this order:
|
||||||
|
|
||||||
1. Point `String.Analytics.origin` (`Sources/Library/Public/Extensions/String+Constants.swift`) at your own [Umami](https://umami.is) instance. It ships as `https://analytics.example.com`, an [RFC 2606](https://www.rfc-editor.org/rfc/rfc2606) reserved domain, so an unconfigured copy can never report to somebody else's server.
|
1. Check `String.Analytics.origin` (`Sources/Library/Public/Extensions/String+Constants.swift`). It ships as `https://analytics.rock-n-code.com`, the platform's shared [Umami](https://umami.is) instance; point it elsewhere if this site reports to another one. The origin alone tracks nothing — the tracker is omitted entirely while `analytics.websiteID` is empty.
|
||||||
2. Extend `security.contentSecurityPolicy` to allow that origin in `script-src` and `connect-src` — the default policy is `'self'`-only, so the tracker is blocked until you do.
|
2. Extend `security.contentSecurityPolicy` to allow that origin in `script-src` and `connect-src` — the default policy is `'self'`-only, so the tracker is blocked until you do.
|
||||||
3. Set `ANALYTICS_WEBSITE_ID` on the deployment.
|
3. Set `ANALYTICS_WEBSITE_ID` on the deployment.
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
extension String {
|
extension String {
|
||||||
/// A namespace for the analytics default configuration values.
|
/// A namespace for the analytics default configuration values.
|
||||||
///
|
///
|
||||||
/// Analytics ships **off**: ``websiteID`` is empty, so the pages embed no tracker until a deployment sets `analytics.websiteID`. Point
|
/// Analytics ships **off**: ``websiteID`` is empty, so the pages embed no tracker until a deployment sets `analytics.websiteID`. Until
|
||||||
/// ``origin`` at your own instance before enabling it — the placeholder is an [RFC 2606](https://www.rfc-editor.org/rfc/rfc2606)
|
/// then ``origin`` is inert — it names the platform's shared instance, which a site reporting to another one repoints before enabling
|
||||||
/// reserved domain, so an unconfigured copy can never report to someone else's server.
|
/// analytics.
|
||||||
public enum Analytics {
|
public enum Analytics {
|
||||||
/// The origin the analytics scripts are loaded from and their beacons are sent to (scheme and host, no trailing slash).
|
/// The origin the analytics scripts are loaded from and their beacons are sent to (scheme and host, no trailing slash).
|
||||||
///
|
///
|
||||||
/// Single-sourced here: both ``scriptURL`` and the session recorder script the pages embed in recorder mode derive from this
|
/// Single-sourced here: both ``scriptURL`` and the session recorder script the pages embed in recorder mode derive from this
|
||||||
/// constant. It is deliberately not a configuration key — the `Content-Security-Policy` must allow the same origin, and a value that
|
/// constant. It is deliberately not a configuration key — the `Content-Security-Policy` must allow the same origin, and a value that
|
||||||
/// can drift at runtime would silently break the tracker it is supposed to permit.
|
/// can drift at runtime would silently break the tracker it is supposed to permit. Defaults to the platform's shared Umami instance.
|
||||||
public static let origin = "https://analytics.rock-n-code.com"
|
public static let origin = "https://analytics.rock-n-code.com"
|
||||||
/// The URL the analytics tracker script is loaded from.
|
/// The URL the analytics tracker script is loaded from.
|
||||||
public static let scriptURL = "\(origin)/script"
|
public static let scriptURL = "\(origin)/script"
|
||||||
|
|||||||
Reference in New Issue
Block a user