Skip to content

Commit

Permalink
VACMS-18416 Homepage custom analytics removal (#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
randimays authored Jul 29, 2024
1 parent a1c8500 commit fb52da3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 101 deletions.
6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ _Note: This field is mandatory for UI changes (non-component work should NOT hav

- [ ] Did you login to a local build and verify all authenticated routes work as expected with a test user

### :warning: Team Sites (only applies to modifications made to the VA.gov header) :warning:

- [ ] The header does not contain any web-components
- [ ] I used the [proxy-rewrite steps](https://github.com/department-of-veterans-affairs/vets-website/tree/main/src/applications/proxy-rewrite#local-dev) to test the injected header scenario
- [ ] I reached out in the `#sitewide-public-websites` Slack channel for questions

## Requested Feedback

(OPTIONAL) _What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?_
25 changes: 2 additions & 23 deletions src/site/includes/common-tasks.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,9 @@
size="3"
></va-icon>
<va-link
disable-analytics
onclick="recordMultipleEvents([
{
event: 'nav-zone-one',
'nav-path': '->{% if link.url.path != empty %}{{ link.url.path }}{% else %}{{ link.label }}{% endif %}',
'click-text': '{{ link.label | strip }}',
},
{
event: 'homepage-search-tools-click', action: 'Other search tools - {{link.label}}'
}
]);"
href="{{ link.url.path }}"
text="{{ link.label }}"
/>
></va-link>
</li>
{% endif %}
{% endfor %}
Expand All @@ -65,19 +54,9 @@
{% if link.url.path and link.label %}
<li>
<va-link
disable-analytics
onclick="recordMultipleEvents([
{
event: 'nav-zone-one',
'nav-path': '->{% if link.url.path != empty %}{{ link.url.path }}{% else %}{{ link.label }}{% endif %}',
'click-text': '{{ link.label | strip }}',
},
{
event: 'homepage-popular-links-click', action: 'Top Pages - {{link.label}}' }
]);"
href="{{ link.url.path }}"
text="{{ link.label }}"
/>
></va-link>
</li>
{% endif %}
{% endfor %}
Expand Down
45 changes: 14 additions & 31 deletions src/site/includes/hero.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
</p>

{% if fieldPromoCta.entity.fieldButtonLabel and fieldPromoCta.entity.fieldButtonLink.url.path %}
<a onclick="recordEvent({ event: 'homepage-benefit-link-click', action: 'Homepage benefit promo - {{fieldPromoCta.entity.fieldButtonLabel}}' })"
class="vads-c-action-link--white" href="{{ fieldPromoCta.entity.fieldButtonLink.url.path }}">
{{fieldPromoCta.entity.fieldButtonLabel}}
</a>
<va-link-action
type="reverse"
href="{{ fieldPromoCta.entity.fieldButtonLink.url.path }}"
text="{{fieldPromoCta.entity.fieldButtonLabel}}"
></va-link-action>
{% endif %}
</div>
</div>
Expand All @@ -36,12 +37,6 @@
<!-- start second column for bplogin card -->
<script>
function openLoginModal() {
// Uncomment custom event and delete generic event once analytics team has implemented
// recordEvent({ event: "homepage-create-account", action: "Homepage Create Account CTA" });
recordMultipleEvents([
{ event: 'cta-button-click', 'button-type': 'primary', 'button-click-label': '{{ createAccountBlock.entityLabel }}' },
{ event: "homepage-create-account", action: "{{ createAccountBlock.fieldPrimaryCtaButtonText }}" }
]);
const params = (new URL(document.location)).searchParams;
params.set("next", "loginModal")
document.location = "?" + params.toString();
Expand All @@ -56,16 +51,13 @@
{{ createAccountBlock.fieldCtaSummaryText }}
</h2>
<va-button
disable-analytics
class="vads-u-margin-bottom--3"
text="{{ createAccountBlock.fieldPrimaryCtaButtonText }}"
onclick="openLoginModal()"
></va-button>
{% for link in createAccountBlock.fieldRelatedInfoLinks %}
<va-link
disable-analytics
href="{{ link.url.path }}"
onclick="recordEvent({ event: 'cta-button-click', 'button-type': 'secondary', 'button-click-label': '{{ link.title }}', });"
text="{{ link.title }}"
></va-link>
{% endfor %}
Expand All @@ -91,34 +83,25 @@
<h2 class="vads-u-color--white vads-u-font-size--lg small-desktop-screen:vads-u-font-size--xl">
Access and manage your VA benefits and health care
</h2>
<a
onclick="recordEvent({ event: 'cta-button-click', 'button-type': 'secondary', 'button-click-label': 'Learn how an account helps you', });"
class="vads-u-color--white vads-u-display--block vads-u-font-weight--normal"
<va-link
reverse
class="vads-u-display--block vads-u-font-weight--normal"
href="/resources/creating-an-account-for-vagov/"
>
Learn how an account helps you
</a>
text="Learn how an account helps you"
></va-link>
<script>
function openLoginModal() {
// Uncomment custom event and delete generic event once analytics team has implemented
// recordEvent({ event: "homepage-create-account", action: "Homepage Create Account CTA" });
recordMultipleEvents([
{ event: 'cta-button-click', 'button-type': 'primary', 'button-click-label': '{{ createAccountBlock.entityLabel }}' },
{ event: "homepage-create-account", action: "{{ createAccountBlock.fieldPrimaryCtaButtonText }}" }
]);
const params = (new URL(document.location)).searchParams;
params.set("next", "loginModal")
document.location = "?" + params.toString();
}
</script>
<button
class="vads-u-background-color--white vads-u-color--primary"
<va-button
class="vads-u-margin-top--2"
onclick="openLoginModal()"
text="Create an account"
type="button"
>
Create an account
</button>
secondary
></va-button>
</div>
</div>
<!-- end first column -->
Expand Down
5 changes: 1 addition & 4 deletions src/site/includes/homepage-benefits.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
<h3 class="heading-level-4 vads-u-display--flex vads-u-align-items--center">
{{ hub.entity.fieldIcon | getHubIcon: '3', 'vads-u-margin-right--1' }}
<va-link
disable-analytics
href="{{ hub.url.path }}"
onclick="recordEvent({ event: 'nav-linkslist', action: 'Benefit hub - {{ hub.label }}' });"
text="{{ hub.label }}"
>
</va-link>
></va-link>
</h3>
<p class="vads-u-margin-top--0">{{ hub.entity.fieldLinkSummary }}</p>
</div>
Expand Down
39 changes: 6 additions & 33 deletions src/site/includes/news-spotlight.drupal.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
{% if fieldPromoHeadline and fieldLink.url.path %}
<h3 class="vads-u-font-family--serif vads-u-margin-top--0 vads-u-font-size--xl">
<va-link
onclick="recordMultipleEvents([
{
event: 'nav-zone-one',
'click-text': '{{ fieldPromoHeadline }}',
},
{ event: 'homepage-news-promo-title-click', action: 'Homepage News Promo - {{ fieldPromoHeadline }} - Title' }
]);"
href="{{ fieldLink.url.path }}"
text="{{ fieldPromoHeadline | encode }}"
reverse
Expand All @@ -42,37 +35,17 @@
{{ fieldPromoText }}
{% endif %}
{% if fieldLinkLabel and fieldLink.url.path %}
{% comment %}
We can convert this link to <va-link> when DST has addressed screen reader text with va-links
https://github.com/department-of-veterans-affairs/vets-design-system-documentation/issues/1644
{% endcomment %}
<a
onclick="recordMultipleEvents([
{
event: 'nav-zone-one',
'click-text': '{{ fieldLinkLabel | strip }}',
},
{ event: 'homepage-news-promo-click', action: 'Homepage news promo - {{ fieldPromoHeadline }} - CTA' }
]);"
href="{{ fieldLink.url.path }}" class="vads-u-color--white">
{{fieldLinkLabel}}
<span class="sr-only">
about {{fieldPromoHeadline}}
</span>
</a>
<va-link
reverse
label="{{fieldLinkLabel}} about {{fieldPromoHeadline}}"
href="{{ fieldLink.url.path }}"
text="{{fieldLinkLabel}}"
/></va-link>
{% endif %}
</p>

<div>
<va-link
onclick="recordMultipleEvents([
{
event: 'nav-zone-one',
'nav-path': '->{% if fieldLink.url.path != empty %}{{ fieldLink.url.path }}{% else %}{{ fieldLinkLabel }}{% endif %}',
'click-text': 'More VA news',
},
{ event: 'homepage-news-promo-more-news-click', action: 'Homepage news promo - More VA News' }
]);"
href="https://news.va.gov/"
text="More VA news"
active
Expand Down
4 changes: 0 additions & 4 deletions src/site/includes/tests/hero/hero.unit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ describe('template: homepage hero', () => {
'This new law expands and extends eligibility for care and benefits for Veterans and survivors related to toxic exposures.',
),
).to.exist;
expect(getByText(heroHTML, 'Learn what the PACT Act means for you')).to
.exist;
});

it('should correctly render the fallback hero when the promo information is not provided', async () => {
Expand All @@ -40,8 +38,6 @@ describe('template: homepage hero', () => {
expect(
getByText(heroHTML, 'Access and manage your VA benefits and health care'),
).to.exist;
expect(getByText(heroHTML, 'Learn how an account helps you')).to.exist;
expect(getByText(heroHTML, 'Create an account')).to.exist;
expect(getAllByRole(heroHTML, 'img').length).to.eq(3);
});
});

0 comments on commit fb52da3

Please sign in to comment.