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

DT-6601 Jyvaskyla analytics with custom event goals #5195

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/component/itinerary/MobileTicketPurchaseInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function MobileTicketPurchaseInformation(
return (
<div className="itinerary-ticket-information-purchase">
{faresInfo()}
<div className="app-link">
<div className="app-link plausible-event-name=Ticket+Purchase+Link">
<ExternalLink
href={config.ticketPurchaseLink(fare, config.ticketLinkOperatorCode)}
onClick={() =>
Expand Down
1 change: 1 addition & 0 deletions app/configurations/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,4 +836,5 @@ export default {
},
],
navigation: false,
sendAnalyticsCustomEventGoals: false,
};
1 change: 1 addition & 0 deletions app/configurations/config.jyvaskyla.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,5 @@ export default configMerger(walttiConfig, {
},
// Notice! Turning on this setting forces the search for car routes (for the CO2 comparison only).
showCO2InItinerarySummary: true,
sendAnalyticsCustomEventGoals: true,
});
10 changes: 8 additions & 2 deletions app/configurations/config.waltti.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,15 @@ export default {
},
ticketButtonTextId: 'buy-in-app',

analyticsScript: function createAnalyticsScript(hostname) {
analyticsScript: function createAnalyticsScript(
hostname,
sendAnalyticsCustomEventGoals,
) {
const address = sendAnalyticsCustomEventGoals
? 'https://plausible.io/js/script.tagged-events.js'
: 'https://plausible.io/js/script.js';
// eslint-disable-next-line no-useless-escape
return `<script defer data-domain="${hostname}" src="https://plausible.io/js/script.js"><\/script>\n`;
return `<script defer data-domain="${hostname}" src="${address}"><\/script>\n`;
},

// features that should not be deployed to production
Expand Down
5 changes: 4 additions & 1 deletion app/util/analyticsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export function getAnalyticsInitCode(config, hostname) {
hostname &&
(!hostname.match(/dev|test/) || config.devAnalytics)
) {
return config.analyticsScript(hostname);
return config.analyticsScript(
hostname,
config.sendAnalyticsCustomEventGoals,
);
}

if (config.GTMid) {
Expand Down
Loading