You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/docs/third-party-services/statistics-and-analytics.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,57 +116,58 @@ plausible:
116
116
117
117
#### Firebase
118
118
119
-
Firebase Analytics provides the functionality of visitor statistics.
119
+
Cloud Firestore provides the functionality of visitor statistics without loading the Firebase JavaScript SDK.
120
120
121
121
{% tabs firestore %}
122
-
<!-- tab Get apiKey & projectId → -->
123
-
Login to [Firebase](https://console.firebase.google.com/u/0/) to get apiKey and projectId. The Web API Key gets generated once you go into the "Authentication" section for the first time.
This configuration allows anyone to read the visitor count but prevents unauthorized writes to the database.
148
+
Replace `articles` if you use a different collection name. These rules allow anonymous reads and count increments while preventing changes to other fields and document deletion. They cannot prevent artificial increments or quota abuse; use a trusted backend if stronger protection is required.
155
149
156
150

157
-
<!-- endtab -->
151
+
<!-- endtab -->
158
152
159
153
<!-- tab NexT Config -->
160
-
Edit {% label primary@NexT config file %} and add or change `firestore` section:
154
+
Find your Project ID in Firebase console under `Project settings → General`, then edit {% label primary@NexT config file %} and add or change the `firestore` section:
155
+
156
+

157
+
158
+
Only the Project ID is required. The Web API Key shown on the same page is not used by NexT.
161
159
162
160
```yml NexT config file
163
161
firestore:
164
162
enable: true
165
163
collection: articles #required, a string collection name to access firestore database
166
-
apiKey: #required
167
164
projectId: #required
168
165
```
169
-
Note: Firestore visitor counting tracks unique visitors (UV) only. The count won't increase on page refresh as it uses browser's localStorage. To test the counter:
166
+
167
+
An API key is not required. NexT uses the [Cloud Firestore REST API](https://firebase.google.com/docs/firestore/use-rest-api), and anonymous requests are authorized by your Firestore Security Rules.
168
+
169
+
Note: Firestore visitor counting records at most one visit per article and browser profile because it uses the browser's localStorage. It is not a reliable unique-visitor metric. To test the counter:
0 commit comments