github.com/TykTechnologies/newrelic-go-agent@v0.0.0-20230823062834-3c80ff5627f6/internal/browser.go (about) 1 // Copyright 2020 New Relic Corporation. All rights reserved. 2 // SPDX-License-Identifier: Apache-2.0 3 4 package internal 5 6 import "bytes" 7 8 // BrowserAttributes returns a string with the attributes that are attached to 9 // the browser destination encoded in the JSON format expected by the Browser 10 // agent. 11 func BrowserAttributes(a *Attributes) []byte { 12 buf := &bytes.Buffer{} 13 14 buf.WriteString(`{"u":`) 15 userAttributesJSON(a, buf, destBrowser, nil) 16 buf.WriteString(`,"a":`) 17 agentAttributesJSON(a, buf, destBrowser) 18 buf.WriteByte('}') 19 20 return buf.Bytes() 21 }