package bn import ( "encoding/json" ) // EngagementConfig contains configuration for the engagement tracker type EngagementConfig struct { PagePath string `json:"pagePath"` PageID string `json:"pageId"` PostWordCount int `json:"postWordCount"` SessionID string `json:"sessionId"` VisitorHash string `json:"visitorHash"` IsPost bool `json:"isPost"` } // engagementConfigJSON converts the config to JSON for embedding in the script func engagementConfigJSON(config EngagementConfig) string { data, err := json.Marshal(config) if err != nil { return "{}" } return string(data) } // EngagementScript renders the blog post engagement tracking script. // Only renders if IsPost is true to avoid bloating regular pages. templ EngagementScript(config EngagementConfig) { if config.IsPost && config.PageID != "" { } }