1. Component Guide
  2. Translation navigation
  3. With tracking
Translation navigation example

With tracking

Data attributes can be passed for each link as shown.

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/translation_nav", {
  translations: [
    {
      locale: "en",
      base_path: "/en",
      text: "English",
      active: true,
      data_attributes: {
        track_category: "categoryEnglish",
        track_action: 1.1,
        track_label: "labelEnglish",
        track_options: {
          dimension28: 1,
          dimension29: "dimension29English"
        }
      }
    },
    {
      locale: "cy",
      base_path: "/cy",
      text: "Cymraeg",
      data_attributes: {
        track_category: "categoryWelsh",
        track_action: 1.2,
        track_label: "labelWelsh",
        track_options: {
          dimension28: 1,
          dimension29: "dimension29Welsh"
        }
      }
    }
  ]
} %>