Skip to content

Commit

Permalink
Merge pull request #100 from companieshouse/lp-275-add-matomo-tracking
Browse files Browse the repository at this point in the history
LP-275 add matomo tracking
  • Loading branch information
markpit authored Dec 17, 2024
2 parents e555871 + 405acb9 commit 7db5955
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/config/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const appConfig = (app: express.Application) => {

nunjucksEnv.addGlobal("CDN_HOST", config.CDN_HOST);
nunjucksEnv.addGlobal("MATOMO_ASSET_PATH", `//${config.CDN_HOST}`);
nunjucksEnv.addGlobal("PIWIK_REGISTRATION_START_GOAL_ID", config.PIWIK_REGISTRATION_START_GOAL_ID);
nunjucksEnv.addGlobal("PIWIK_SITE_ID", config.PIWIK_SITE_ID);
nunjucksEnv.addGlobal("PIWIK_URL", config.PIWIK_URL);
nunjucksEnv.addGlobal("SERVICE_NAME", config.SERVICE_NAME);
Expand Down
1 change: 1 addition & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const LOG_LEVEL = getEnvironmentValue("LOG_LEVEL");
export const NODE_ENV = process.env["NODE_ENV"];
export const OAUTH2_CLIENT_ID = getEnvironmentValue("OAUTH2_CLIENT_ID");
export const OAUTH2_CLIENT_SECRET = getEnvironmentValue("OAUTH2_CLIENT_SECRET");
export const PIWIK_REGISTRATION_START_GOAL_ID = getEnvironmentValue("PIWIK_REGISTRATION_START_GOAL_ID");
export const PIWIK_SITE_ID = getEnvironmentValue("PIWIK_SITE_ID");
export const PIWIK_URL = getEnvironmentValue("PIWIK_URL");
export const PORT = getEnvironmentValue("PORT");
Expand Down
1 change: 1 addition & 0 deletions src/test/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default () => {
process.env.NODE_ENV = "development";
process.env.OAUTH2_CLIENT_ID = "OAUTH2_CLIENT_ID";
process.env.OAUTH2_CLIENT_SECRET = "OAUTH2_CLIENT_SECRET";
process.env.PIWIK_REGISTRATION_START_GOAL_ID = "45";
process.env.PIWIK_SITE_ID = "24";
process.env.PIWIK_URL = "piwik.url";
process.env.PORT = "3000";
Expand Down
2 changes: 1 addition & 1 deletion src/views/includes/piwik-scripts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
window.PIWIK_URL = '{{ PIWIK_URL }}'
window.PIWIK_SITE_ID = '{{ PIWIK_SITE_ID }}'
</script>
<div id="templateName" data-id='{{templateName}}' hidden></div>
<div id="templateName" data-id='{{ props.pageType }}' hidden></div>
<script src="{{MATOMO_ASSET_PATH}}/javascripts/app/cookie-consent/cookie-consent-1.0.0.js"></script>
<script src="{{MATOMO_ASSET_PATH}}/javascripts/app/cookie-consent/matomo-only-cookie-consent.js"></script>
<noscript>
Expand Down
4 changes: 2 additions & 2 deletions src/views/start.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

{{ errorMessage }}

<button class="govuk-button" onClick="location.href='{{ props.nextUrl }}'">Start</button>

<button class="govuk-button" onClick="_paq.push(['trackGoal', '{{PIWIK_REGISTRATION_START_GOAL_ID}}']); location.href='{{ props.nextUrl }}'">Start</button>
{% endblock %}
15 changes: 10 additions & 5 deletions src/views/which-type.njk
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,40 @@
value: "LP",
text: i18n.whichTypePage.options.LP,
attributes: {
required: true
"required": true,
"data-event-id": "which-type-of-partnership-to-register-radio - limited-partnership-england-wales"
}
},
{
value: "PFLP",
text: i18n.whichTypePage.options.PFLP,
attributes: {
required: true
"required": true,
"data-event-id": "which-type-of-partnership-to-register-radio - private-fund-limited-partnership-england-wales"
}
},
{
value: "SLP",
text: i18n.whichTypePage.options.SLP,
attributes: {
required: true
"required": true,
"data-event-id": "which-type-of-partnership-to-register-radio - scottish-limited-partnership"
}
},
{
value: "SPFLP",
text: i18n.whichTypePage.options.SPFLP,
attributes: {
required: true
"required": true,
"data-event-id": "which-type-of-partnership-to-register-radio - private-fund-limited-partnership-in-scotland"
}
},
{
value: "SQP",
text: i18n.whichTypePage.options.SQP,
attributes: {
required: true
"required": true,
"data-event-id": "which-type-of-partnership-to-register-radio - scottish-qualifying-partnership"
}
}
]
Expand Down

0 comments on commit 7db5955

Please sign in to comment.