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

IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementation #571

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
980dc03
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Dec 27, 2024
f3f908d
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 2, 2025
95e5e03
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 2, 2025
b39c384
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 8, 2025
51f4aa3
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 8, 2025
85cfc5f
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 8, 2025
f9ff39b
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 9, 2025
d828199
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 15, 2025
234fcc7
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 15, 2025
bc313c0
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 16, 2025
f566dc3
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 16, 2025
754cf2e
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 16, 2025
10de623
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics Implementa…
rdas-ch Jan 17, 2025
983abe6
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics TMP Implem…
rdas-ch Jan 21, 2025
ad99bba
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics TMP Implem…
rdas-ch Jan 22, 2025
bfb04c3
IDVA5-1621 ACSP Registration - Updates to Matomo Analytics TMP Implem…
rdas-ch Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,4 @@
</div>
<button class="govuk-button" id="save-continue-button">{{ i18n.SaveAndContinue}}</button>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("different-address-id", "{{title}}", "select-option", "different-address");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE");
</script>

{% endblock main_content %}
7 changes: 1 addition & 6 deletions src/views/common/aml-body-number/aml-body-number.njk
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,4 @@
}) }}
</fieldset>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - AML number");
</script>

{% endblock %}
{% endblock %}
7 changes: 1 addition & 6 deletions src/views/common/check-aml-details/check-aml-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,4 @@
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Check AML details");
</script>

{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "CONFIRM AND CONTINUE - address correspondence confirm");
trackEventBasedOnPageTitle("edit-address-link", "{{title}}", "click-link", "EDIT ADDRESS - edit correspondence address");
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,5 @@
</div>

<button class="govuk-button" id="save-continue-button">{{ i18n.SaveAndContinue }}</button>
</form>
<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE");
</script>
</form>
{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
<a href={{correspondenceAddressManualLink}} class="govuk-link" id="manual-address-id">{{ i18n.correspondenceLookUpAddressManuallyBtn }}</a>
</p>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("find-address-id", "{{title}}", "click-button", "FIND ADDRESS");
trackEventBasedOnPageTitle("manual-address-id", "{{title}}", "click-link", "Enter address manually");
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("manual-address-id", "{{title}}", "click-link", "Enter address manually");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Address Correspondence");
</script>

{% endblock main_content %}
1 change: 0 additions & 1 deletion src/views/common/index/home.njk
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@

function startNowEventListener () {
document.getElementById("start-now").addEventListener("click", () => {
trackEventBasedOnPageTitle("start-now", "{{matomoPageTitle}}", "click-button", "START NOW");
_paq.push(['trackGoal', "{{ PIWIK_REGISTRATION_START_GOAL_ID }}"]);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,8 @@
]
}) }}
{{ govukButton({
text: i18n.SaveAndContinue,
id:"save-continue-button"
text: i18n.SaveAndContinue,
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("name-of-the-business-option-id", "{{title}}", "select-option", "name-of-the-business");
trackEventBasedOnPageTitle("your-name-option-id", "{{title}}", "select-option", "your-name");
trackEventBasedOnPageTitle("both-option-id", "{{title}}", "select-option", "both");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Name registered with AML");
</script>

{% endblock main_content %}
{% endblock main_content %}
2 changes: 0 additions & 2 deletions src/views/common/name/capture-name.njk
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("continue-button-id", "{{title}}", "click-button", "CONTINUE - UPDATENAME");
trackEventBasedOnPageTitle("cancel-id", "{{title}}", "click-link", "CANCEL - UPDATENAME");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - NAME");
</script>

{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</form>

<script type="text/javascript" nonce={{ nonce | dump | safe }}>

ignoreRadioButtonForThisPage = true;
function continueEventListener () {
document.getElementById("save-continue-button").addEventListener("click", () => {
const selectedOption = document.querySelector('input[name="otherTypeOfBusinessRadio"]:checked');
Expand All @@ -67,10 +67,6 @@
}
_paq.push(['trackGoal', goalId]);
}

trackEventBasedOnPageTitle("UNINCORPORATED", "{{title}}", "select-option", "Unincorporated Entity");
trackEventBasedOnPageTitle("CORPORATE_BODY", "{{title}}", "select-option", "Corporate Body");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - OTHER TYPE");

if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function (e) {
Expand Down
9 changes: 1 addition & 8 deletions src/views/common/saved-application/saved-application.njk
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,4 @@
}) }}
<button class="govuk-button" id="save-continue-button" >{{ i18n.SaveAndContinue }}</button>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("yes-id", "{{title}}", "select-option", "savedApplication-yes");
trackEventBasedOnPageTitle("no-id", "{{title}}", "select-option", "savedApplication-no");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE");
</script>

{% endblock main_content %}
{% endblock main_content %}
23 changes: 1 addition & 22 deletions src/views/common/sector-you-work-in/sector-you-work-in.njk
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,4 @@
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
let selectedRadio = null;

// Function to track Matomo analytics based on the selected radio button
function trackRadioSelection() {
const radioButtons = document.querySelectorAll('input[name="sectorYouWorkIn"]');
radioButtons.forEach((radio) => {
radio.addEventListener("click", (event) => {
selectedRadio = event.target;
const labelText = document.querySelector(`label[for="${selectedRadio.id}"]`).textContent.trim();
trackEventBasedOnRadioId(selectedRadio.id, "{{title}}", "select-option", labelText);
});
});
}

// Run trackRadioSelection function
trackRadioSelection();
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Sector you work in");
</script>

{% endblock main_content %}
{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
document.querySelectorAll('input[type="checkbox"][id^="aml"]').forEach(function (checkbox) {
trackEventBasedOnPageTitle(checkbox.id, "{{title}}","select-option", checkbox.value);
});
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Which AML Bodies");
</script>

{% endblock main_content %}
12 changes: 2 additions & 10 deletions src/views/common/type-of-business/type-of-business.njk
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
}) }}
</form>
<script type="text/javascript" nonce={{ nonce | dump | safe }}>

function continueEventListener () {
document.getElementById("save-continue-button").addEventListener("click", () => {
const selectedOption = document.querySelector('input[name="typeOfBusinessRadio"]:checked');
if (selectedOption) {
const selectedValue = selectedOption.value;
if (selectedValue !== "OTHER") {
ignoreRadioButtonForThisPage = true;
trackGoal(selectedValue);
}
}
Expand All @@ -88,14 +88,6 @@
_paq.push(['trackGoal', goalId]);
}

trackEventBasedOnPageTitle("LC", "{{title}}", "select-option", "Limited Company");
trackEventBasedOnPageTitle("LP", "{{title}}", "select-option", "Limited Partnership");
trackEventBasedOnPageTitle("LLP", "{{title}}", "select-option", "Limited Liability Partnerships");
trackEventBasedOnPageTitle("PARTNERSHIP", "{{title}}", "select-option", "Partnership Not Registered With CH");
trackEventBasedOnPageTitle("SOLE_TRADER", "{{title}}", "select-option", "Sole Trader");
trackEventBasedOnPageTitle("OTHER", "{{title}}", "select-option", "Other");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - TYPE");

if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function (e) {
continueEventListener()
Expand All @@ -104,4 +96,4 @@
continueEventListener()
}
</script>
{% endblock main_content %}
{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@

<button class="govuk-button" id="save-continue-button">{{i18n.SaveAndContinue}}</button>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Business-name");
</script>

{% endblock main_content %}
{% endblock main_content %}
7 changes: 1 addition & 6 deletions src/views/common/what-is-your-email/what-is-your-email.njk
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,4 @@
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - email address");
</script>

{% endblock main_content %}
{% endblock main_content %}
39 changes: 6 additions & 33 deletions src/views/common/what-is-your-role/what-is-your-role.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
value: "MEMBER_OF_PARTNERSHIP",
id: "member-of-partnership",
text: i18n.member + unincorporatedBusinessName
text: i18n.member + unincorporatedBusinessName | upper
} if acspType == "PARTNERSHIP",

{
Expand All @@ -35,19 +35,19 @@

{
value: "MEMBER_OF_GOVERNING_BODY",
text: i18n.memberOfGoverningBody + unincorporatedBusinessName,
text: i18n.memberOfGoverningBody + unincorporatedBusinessName | upper,
id: "member-of-governing-body"
} if acspType == "UNINCORPORATED",

{
value: "EQUIVALENT_OF_DIRECTOR",
text: i18n.equivalentToDirector + unincorporatedBusinessName,
text: i18n.equivalentToDirector + unincorporatedBusinessName | upper,
id: "director-equivalent"
} if acspType == "CORPORATE_BODY",

{
value: "MEMBER_OF_ENTITY",
text: i18n.member + unincorporatedBusinessName,
text: i18n.member + unincorporatedBusinessName | upper,
id: "member-of-entity"
} if acspType == "UNINCORPORATED" or acspType == "CORPORATE_BODY",

Expand All @@ -65,7 +65,7 @@

{
value: "GENERAL_PARTNER",
text: i18n.generalPartner + unincorporatedBusinessName,
text: i18n.generalPartner + unincorporatedBusinessName | upper,
id: "general-partner"
} if acspType == "LP",

Expand All @@ -82,31 +82,4 @@
id:"save-continue-button"
}) }}
</form>

{# If/Else Logic to call specific Matomo event script based on the value of acspType (specific script runs depending on what busniess type the user had selected previously) #}
{% if acspType == "PARTNERSHIP" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("member-of-partnership", "{{title}}", "select-option", "I am a member of partnership"); </script>
{% elif acspType == "SOLE_TRADER" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("sole-trader", "{{title}}", "select-option", "I am the sole trader"); </script>
{% elif acspType == "UNINCORPORATED" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("member-of-governing-body", "{{title}}", "select-option", "I am a member of the governing body of"); </script>
{% elif acspType == "CORPORATE_BODY" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("director-equivalent", "{{title}}", "select-option", "I am the equivalent of a director of"); </script>
{% elif acspType == "LC" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("I-am-director", "{{title}}", "select-option", "I am a director of"); </script>
{% elif acspType == "LLP" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("member-of-llp", "{{title}}", "select-option", "I am a member of llp"); </script>
{% elif acspType == "LP" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("general-partner", "{{title}}", "select-option", "I am a general partner of"); </script>
{% endif %}

{% if acspType == "UNINCORPORATED" or acspType == "CORPORATE_BODY" %}
<script nonce={{ nonce | dump | safe }}> trackEventBasedOnPageTitle("member-of-entity", "{{title}}", "select-option", "I am a member of entity"); </script>
{% endif %}

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("someone-else", "{{title}}", "select-option", "I am someone else");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - ROLE");
</script>

{% endblock main_content %}
{% endblock main_content %}
20 changes: 0 additions & 20 deletions src/views/common/which-sector-other/which-sector-other.njk
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,6 @@
</form>

<script nonce={{ nonce | dump | safe }}>
let selectedRadio = null;

// Function to track Matomo analytics based on the selected radio button
function trackRadioSelection() {
const radioButtons = document.querySelectorAll('input[name="whichSectorOther"]');
radioButtons.forEach((radio) => {
radio.addEventListener("click", (event) => {
// Set selectedRadio to the capture the properties of the selected radio button
selectedRadio = event.target;
// Capture the text content of the selected radio button
const labelText = document.querySelector(`label[for="${selectedRadio.id}"]`).textContent.trim();
// Track event based on the selected radio button id and text content
trackEventBasedOnRadioId(selectedRadio.id, "{{title}}", "select-option", labelText);
});
});
}

trackRadioSelection();
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - OTHER SECTOR");
trackEventBasedOnPageTitle("back-link-id", "{{title}}", "click-link", "Back to main business sector");
</script>

{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,4 @@

<button class="govuk-button" id="accept-continue-id">{{ i18n.AcceptAndContinue }}</button>
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("accept-continue-id", "{{title}}", "click-button", "accept-continue");
</script>

{% endblock main_content %}
{% endblock main_content %}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("find-company-number-link", "{{title}}", "click-link", 'How do I find the company number');
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", 'SAVE AND CONTINUE - Company Number');
</script>

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "CONFIRM AND CONTINUE - Is this your company");
trackEventBasedOnPageTitle("choose-company-link", "{{title}}", "click-link", "Choose a different company");
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,4 @@
id:"save-continue-button"
}) }}
</form>

<script nonce={{ nonce | dump | safe }}>
trackEventBasedOnPageTitle("name-of-the-business-option-id", "{{title}}", "select-option", "name-of-the-business");
trackEventBasedOnPageTitle("different-name-option-id", "{{title}}", "select-option", "different-name");
trackEventBasedOnPageTitle("save-continue-button", "{{title}}", "click-button", "SAVE AND CONTINUE - Name registered with AML");
</script>

{% endblock main_content %}
{% endblock main_content %}
Loading