Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add organisation meta tag if current page is org #397

Merged
merged 1 commit into from
Jul 11, 2018

Conversation

vanitabarrett
Copy link
Contributor

@vanitabarrett vanitabarrett commented Jul 9, 2018

Trello: https://trello.com/c/cbRSHmA9/30-add-organisation-id-to-custom-dimensions-in-google-analytics

Adds the govuk:analytics:organisations meta tag if the current page is an org (has an analytics_identifier value in the content item)

Component guide for this PR:
https://govuk-publishing-compon-pr-397.herokuapp.com/component-guide

@binaryberry binaryberry temporarily deployed to govuk-publishing-compon-pr-397 July 9, 2018 13:01 Inactive
@vanitabarrett
Copy link
Contributor Author

vanitabarrett commented Jul 9, 2018

@sihugh I think this will fix: https://trello.com/c/cbRSHmA9/30-add-organisation-id-to-custom-dimensions-in-google-analytics . Can you take a look, I'm not sure how it's currently set up in Whitehall so there may be a better fix

@vanitabarrett vanitabarrett requested a review from sihugh July 9, 2018 13:03
Copy link
Contributor

@tijmenb tijmenb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanitabarrett
Copy link
Contributor Author

@tijmenb Potentially, although from what I could see only organisations actually have a value for analytics_identifier - the rest seem to be null. I can add a check against the document_type though to make sure we only do this for organisations?

@vanitabarrett vanitabarrett force-pushed the add-org-to-meta-tag branch from f273de1 to 8455545 Compare July 9, 2018 15:03
@binaryberry binaryberry temporarily deployed to govuk-publishing-compon-pr-397 July 9, 2018 15:04 Inactive
@vanitabarrett
Copy link
Contributor Author

@tijmenb I've adjusted the logic slightly so we only set govuk:analytics:organisations to be equal to the high level content_item[:analytics_identifier] if the document is an organisation.

@vanitabarrett vanitabarrett force-pushed the add-org-to-meta-tag branch from 8455545 to 7a5e905 Compare July 9, 2018 15:06
@binaryberry binaryberry temporarily deployed to govuk-publishing-compon-pr-397 July 9, 2018 15:06 Inactive
@benthorner benthorner temporarily deployed to govuk-publishing-compon-pr-397 July 10, 2018 15:43 Inactive
else
organisations = []
organisations += links[:organisations] || []
organisations += links[:worldwide_organisations] || []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if you could replace the conditional by adding this line?

organisations += [content_item] if content_item[:document_type] == "organisation"

Adds the govuk:analytics:organisations meta tag if the current page is an org (has an analytics_identifier value in the content item)
@benthorner benthorner had a problem deploying to govuk-publishing-compon-pr-397 July 11, 2018 08:44 Failure
@vanitabarrett vanitabarrett merged commit 88cf66b into master Jul 11, 2018
@vanitabarrett vanitabarrett deleted the add-org-to-meta-tag branch July 11, 2018 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants