This is content for accordion 1 of 2
With track show all clicks
To switch on Google Analytics for the “Show all sections” button on click, pass track_show_all_clicks: true
the values passed on open will be
Event Action: accordionOpened
Event Category: pageElementInteraction
Event Label: Show all sections
How it looks (preview)
This is content for accordion 2 of 2
How to call this example
<%= render "govuk_publishing_components/components/accordion", {
track_show_all_clicks: true,
items: [
{
heading: {
text: "Writing well for the web",
id: "writing-well-for-the-web-2"
},
content: {
html: sanitize("<p class=\"govuk-body\">This is content for accordion 1 of 2</p>")
}
},
{
heading: {
text: "Writing well for specialists"
},
content: {
html: sanitize("<p class=\"govuk-body\">This is content for accordion 2 of 2</p>")
}
}
]
} %>