Skip to content

Commit

Permalink
Make deploying meta tags changes easier
Browse files Browse the repository at this point in the history
- recently updated the names of some of the metatags that GA4 reads for page views
- but it's possible that the changes to those metatags won't be appearing for a while on a lot of pages, as they probably need republishing first
- so for now let's read either the new or the old metatag (which will contain the same information) and avoid breaking a part of the GA4 tracking
- haven't done the same for the strip dates/postcodes/etc. metatags as I think they're all handled internal to the gem
- follow up to changes made in #4222
  • Loading branch information
andysellick committed Sep 18, 2024
1 parent 487cd72 commit 197765c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

## Unreleased

* Make deploying meta tags changes easier ([PR #4236](https://github.com/alphagov/govuk_publishing_components/pull/4236))
* Update metatags for GA4 ([PR #4222](https://github.com/alphagov/govuk_publishing_components/pull/4222))
* Set aria-label text in govuk_logo.html to "GOV.UK" ([PR #4217](https://github.com/alphagov/govuk_publishing_components/pull/4217))
* Fix cookie expiration date potentially relying on user's timezone ([PR #4219](https://github.com/alphagov/govuk_publishing_components/pull/4219))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
navigation_page_type: this.getMetaContent('navigation-page-type'),
navigation_list_type: this.getMetaContent('navigation-list-type'),
step_navs: this.getMetaContent('stepnavs'),
taxonomy_level1: this.getMetaContent('taxonomy_level1'),
taxonomy_level1: this.getMetaContent('taxonomy_level1') || this.getMetaContent('themes'),
taxonomy_main: this.getMetaContent('taxon-slug'),
taxonomy_main_id: this.getMetaContent('taxon-id'),
taxonomy_all: this.getMetaContent('taxon-slugs'),
Expand All @@ -49,8 +49,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
publishing_government: this.removeHyphensAndDowncase(this.getMetaContent('publishing-government') || this.getMetaContent('ga4-publishing-government')),
political_status: this.getMetaContent('political-status') || this.getMetaContent('ga4-political-status'),
primary_publishing_organisation: this.getMetaContent('primary-publishing-organisation'),
organisations: this.getMetaContent('organisations'),
world_locations: this.getMetaContent('world-locations'),
organisations: this.getMetaContent('organisations') || this.getMetaContent('analytics:organisations'),
world_locations: this.getMetaContent('world-locations') || this.getMetaContent('world-locations'),

/* The existence of a referrer parameter indicates that the page has been dynamically updated via an AJAX request
and therefore we can use it to set the dynamic property appropriately. This value is used by PA's to differentiate
Expand Down

0 comments on commit 197765c

Please sign in to comment.