1. Component Guide
  2. Single page notification button
  3. With ga4 tracking
Single page notification button example

With ga4 tracking

To add GA4 tracking, pass a ga4_data_attributes object with the necessary properties to the component. For example:-

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/single_page_notification_button", {
  base_path: "/current-page-path",
  ga4_data_attributes: {
    module: "ga4-link-tracker",
    ga4_link: {
      event_name: "navigation",
      type: "subscribe",
      index: {
        index_link: 1
      },
      index_total: 1,
      section: "Top"
    }
  }
} %>