Skip to content

Commit

Permalink
Merge pull request #3938 from alphagov/fix-tiny-things
Browse files Browse the repository at this point in the history
Fix some really tiny things
  • Loading branch information
andysellick committed Mar 21, 2024
2 parents c222616 + aca222d commit e31f345
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/analytics-ga4/ga4-all-trackers.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The [form tracker](https://github.com/alphagov/govuk_publishing_components/blob/
There are several types of link tracking. To distinguish them and simplify the code, we define them as follows.

- the [link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) handles link clicks with data attributes added to specific links, or to parent elements of groups of links
- the [specialist link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-specialist-link-tracker.md)automatically tracks clicks on 'special' links, such as external links, download links and mailto links
- the [specialist link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-specialist-link-tracker.md) automatically tracks clicks on 'special' links, such as external links, download links and mailto links

## Print intent tracker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,46 @@ describe('A specialist link tracker', function () {
/* The link_domain, external and path attributes exist so we can hardcode what the expected value is for each test.
The value differs for each link, so we can't hardcode the expected value inside the test itself. */
links.innerHTML =
'<div class="fully-structured-external-links">' +
'<a href="http://www.nationalarchives.gov.uk/1" link_domain="http://www.nationalarchives.gov.uk" path="/1"> National Archives </a>' +
'<a href="https://www.nationalarchives.gov.uk/2" link_domain="https://www.nationalarchives.gov.uk" path="/2"></a>' +
'<a href="https://www.nationalarchives.gov.uk/3.pdf" link_domain="https://www.nationalarchives.gov.uk" path="/3.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="external-links-with-data-attributes">' +
'<a href="http://www.nationalarchives.gov.uk/1" link_domain="http://www.nationalarchives.gov.uk" path="/1"> National Archives </a>' +
'<a href="http://www.nationalarchives.gov.uk/2" link_domain="http://www.nationalarchives.gov.uk" path="/2"> National Archives </a>' +
'</div>' +
'<div class="www-less-external-links">' +
'<a href="http://nationalarchives.gov.uk/1" path="/1" link_domain="http://nationalarchives.gov.uk"> National Archives </a>' +
'<a href="https://nationalarchives.gov.uk/2" path="/2" link_domain="https://nationalarchives.gov.uk"></a>' +
'<a href="https://nationalarchives.gov.uk/one.pdf" link_domain="https://nationalarchives.gov.uk" path="/one.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="protocol-relative-external-links">' +
'<a href="//nationalarchives.gov.uk"> National Archives </a>' +
'<a href="//nationalarchives.gov.uk"></a>' +
'<a href="//nationalarchives.gov.uk/one.pdf" path="/one.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="nested-link">' +
'<a href="http://www.nationalarchives.gov.uk"> <img /> </a>' +
'</div>' +
'<div class="internal-links">' +
'<a href="/some-path">Local link</a>' +
'<a href="http://www.gov.uk/some-path">Another local link</a>' +
'<a href="https://www.gov.uk/some-path">Another local link</a>' +
'<a href="https://gov.uk/some-path">Another local link</a>' +
'<a href="//gov.uk/some-path">Another local link</a>' +
'</div>' +
'<div class="anchor-links">' +
'<a href="#some-id">Anchor link</a>' +
'<a href="#https://www.gov.uk">Another anchor link</a>' +
'<a href="#https://www.example.com">Another anchor link</a>' +
'</div>' +
'<div data-ga4-link="something">' +
'<a href="//nationalarchives.gov.uk" class="alreadytracked"> National Archives </a>' +
'</div>' +
'<div data-ga4-ecommerce-path="something">' +
'<a href="#https://www.example.com" class="resultLink">A search result link</a>' +
'</div>'
'<div class="fully-structured-external-links">' +
'<a href="http://www.nationalarchives.gov.uk/1" link_domain="http://www.nationalarchives.gov.uk" path="/1"> National Archives </a>' +
'<a href="https://www.nationalarchives.gov.uk/2" link_domain="https://www.nationalarchives.gov.uk" path="/2"></a>' +
'<a href="https://www.nationalarchives.gov.uk/3.pdf" link_domain="https://www.nationalarchives.gov.uk" path="/3.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="external-links-with-data-attributes">' +
'<a href="http://www.nationalarchives.gov.uk/1" link_domain="http://www.nationalarchives.gov.uk" path="/1"> National Archives </a>' +
'<a href="http://www.nationalarchives.gov.uk/2" link_domain="http://www.nationalarchives.gov.uk" path="/2"> National Archives </a>' +
'</div>' +
'<div class="www-less-external-links">' +
'<a href="http://nationalarchives.gov.uk/1" path="/1" link_domain="http://nationalarchives.gov.uk"> National Archives </a>' +
'<a href="https://nationalarchives.gov.uk/2" path="/2" link_domain="https://nationalarchives.gov.uk"></a>' +
'<a href="https://nationalarchives.gov.uk/one.pdf" link_domain="https://nationalarchives.gov.uk" path="/one.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="protocol-relative-external-links">' +
'<a href="//nationalarchives.gov.uk"> National Archives </a>' +
'<a href="//nationalarchives.gov.uk"></a>' +
'<a href="//nationalarchives.gov.uk/one.pdf" path="/one.pdf">National Archives PDF</a>' +
'</div>' +
'<div class="nested-link">' +
'<a href="http://www.nationalarchives.gov.uk"> <img /> </a>' +
'</div>' +
'<div class="internal-links">' +
'<a href="/some-path">Local link</a>' +
'<a href="http://www.gov.uk/some-path">Another local link</a>' +
'<a href="https://www.gov.uk/some-path">Another local link</a>' +
'<a href="https://gov.uk/some-path">Another local link</a>' +
'<a href="//gov.uk/some-path">Another local link</a>' +
'</div>' +
'<div class="anchor-links">' +
'<a href="#some-id">Anchor link</a>' +
'<a href="#https://www.gov.uk">Another anchor link</a>' +
'<a href="#https://www.example.com">Another anchor link</a>' +
'</div>' +
'<div data-ga4-link="something">' +
'<a href="//nationalarchives.gov.uk" class="alreadytracked"> National Archives </a>' +
'</div>' +
'<div data-ga4-ecommerce-path="something">' +
'<a href="#https://www.example.com" class="resultLink">A search result link</a>' +
'</div>'

body.appendChild(links)
body.addEventListener('click', preventDefault)
Expand Down

0 comments on commit e31f345

Please sign in to comment.