1. Component Guide
  2. Document list
  3. With data attributes on links
Document list example

With data attributes on links

Note that the component does not include built in Universal Analytics tracking. If this is required consider using the track click script.

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/document_list", {
  items: [
    {
      link: {
        text: "School behaviour and attendance: parental responsibility measures",
        path: "/government/publications/parental-responsibility-measures-for-behaviour-and-attendance",
        data_attributes: {
          track_category: "navDocumentCollectionLinkClicked",
          track_action: 1.1,
          track_label: "/government/publications/parental-responsibility-measures-for-behaviour-and-attendance",
          track_options: {
            dimension28: 2,
            dimension29: "School behaviour and attendance: parental responsibility measures"
          }
        }
      },
      metadata: {
        public_updated_at: "2017-01-05 14:50:33 +0000",
        document_type: "Statutory guidance"
      }
    },
    {
      link: {
        text: "School exclusion",
        path: "/government/publications/school-exclusion",
        data_attributes: {
          track_category: "navDocumentCollectionLinkClicked",
          track_action: 1.2,
          track_label: "/government/publications/school-exclusion",
          track_options: {
            dimension28: 2,
            dimension29: "School exclusion"
          }
        }
      },
      metadata: {
        public_updated_at: "2017-07-19 15:01:48 +0000",
        document_type: "Statutory guidance"
      }
    }
  ]
} %>