Skip to content

Commit

Permalink
Fix naming, push config if statement inside pageview manager
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Jan 3, 2025
1 parent 9432d2f commit 996f5dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/page-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class PageViewManager {

const scrollContext = this._instance.scrollManager.getContext()

if (scrollContext) {
if (scrollContext && !this._instance.config.disable_scroll_properties) {
let { maxScrollHeight, lastScrollY, maxScrollY, maxContentHeight, lastContentY, maxContentY } =
scrollContext

Expand Down
18 changes: 8 additions & 10 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,17 +986,15 @@ export class PostHog {
properties = extend(properties, sessionProps)
}

if (!this.config.disable_scroll_properties) {
let performanceProperties: Record<string, any> = {}
if (event_name === '$pageview') {
performanceProperties = this.pageViewManager.doPageView(timestamp, uuid)
} else if (event_name === '$pageleave') {
performanceProperties = this.pageViewManager.doPageLeave(timestamp)
} else {
performanceProperties = this.pageViewManager.doEvent()
}
properties = extend(properties, performanceProperties)
let pageviewProperties: Record<string, any>
if (event_name === '$pageview') {
pageviewProperties = this.pageViewManager.doPageView(timestamp, uuid)
} else if (event_name === '$pageleave') {
pageviewProperties = this.pageViewManager.doPageLeave(timestamp)
} else {
pageviewProperties = this.pageViewManager.doEvent()
}
properties = extend(properties, pageviewProperties)

if (event_name === '$pageview' && document) {
properties['title'] = document.title
Expand Down

0 comments on commit 996f5dc

Please sign in to comment.