With data attributes
Data attributes can be applied as required. Note that the component does not include built in tracking. If this is required consider using the GA4 link tracker.
How it looks (preview)
How to call this example
<%= render "govuk_publishing_components/components/button", {
text: "Track this!",
margin_bottom: true,
data_attributes: {
module: "cross-domain-tracking",
"tracking-code": "GA-123ABC",
"tracking-name": "transactionTracker"
}
} %>