1. Component Guide
  2. Intervention
  3. With data attributes
Intervention example

With data attributes

This example shows the use of suggestion_data_attributes and dismiss_data_attributes for click tracking.

How it looks (preview)

Based on your browsing you might be interested in Travel abroad: step by step

Hide this suggestion

How to call this example

<%= render "govuk_publishing_components/components/intervention", {
  suggestion_text: "Based on your browsing you might be interested in",
  suggestion_link_text: "Travel abroad: step by step",
  suggestion_link_url: "/travel-abroad",
  suggestion_data_attributes: {
    module: "gem-track-click",
    "track-category": "interventionBanner",
    "track-action": "interventionClicked",
    "track-dimension": "Travel abroad: step by step",
    "track-dimension-index": "29",
    "track-label": "clicked suggestion"
  },
  dismiss_text: "Hide this suggestion",
  dismiss_data_attributes: {
    module: "gem-track-click",
    "track-category": "interventionBanner",
    "track-action": "interventionDismissed",
    "track-dimension": "Hide this suggestion",
    "track-dimension-index": "29",
    "track-label": "hid the intervention"
  }
} %>