Skip to content

Commit ac231e0

Browse files
authored
3335 feature request add app version to posthog (#3348)
# Description of Changes Please provide a summary of the changes, including: Added app_version to all posthog captures Closes #(3335) --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details.
1 parent f0ed60a commit ac231e0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/stirling/software/SPDF/service/PostHogService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public void captureEvent(String eventName, Map<String, Object> properties) {
6363
if (!applicationProperties.getSystem().isAnalyticsEnabled()) {
6464
return;
6565
}
66+
67+
properties.put("app_version", appVersion);
6668
postHog.capture(uniqueId, eventName, properties);
6769
}
6870

src/main/resources/templates/fragments/common.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@
8484

8585
function UpdatePosthogConsent(){
8686
if(typeof(posthog) == "undefined") {
87-
console.log("Posthog not initialised");
8887
return;
8988
}
9089

9190
window.CookieConsent.acceptedCategory('analytics')?
9291
posthog.opt_in_capturing() : posthog.opt_out_capturing();
93-
console.log("Posthog: Opted " + (posthog.has_opted_out_capturing()? "out" : "in"));
9492
}
9593
const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ '';
9694
const analyticsEnabled = /*[[${@analyticsEnabled}]]*/ false;
@@ -150,8 +148,9 @@
150148
const baseUrl = window.location.hostname;
151149
posthog.register_once({
152150
'hostname': baseUrl,
153-
'UUID': /*[[${@UUID}]]*/ ''
154-
})
151+
'UUID': /*[[${@UUID}]]*/ '',
152+
'app_version': /*[[${@appVersion}]]*/ '',
153+
});
155154
}
156155

157156
window.addEventListener("cc:onConsent", UpdatePosthogConsent);

0 commit comments

Comments
 (0)