Skip to content

Commit

Permalink
Add utm_source parameter to notification emails
Browse files Browse the repository at this point in the history
It might have been possible to do this in the content template, but this
feels more reliable. This will help judge traffic from assignment, test,
and group join notification emails
  • Loading branch information
jsharkey13 committed Oct 11, 2024
1 parent 63de1a5 commit 4787f9c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ public AssignmentDTO createAssignment(final AssignmentDTO newAssignment) throws
newAssignment.setId(this.assignmentPersistenceManager.saveAssignment(newAssignment));

GameboardDTO gameboard = newAssignment.getGameboard();
final String gameboardURL = String.format("https://%s/assignment/%s", properties.getProperty(HOST_NAME),
gameboard.getId());
final String gameboardURL = getAssignmentLikeUrl(newAssignment);

// If there is no date to schedule the assignment for, or the start date is in the past...
if (null == newAssignment.getScheduledStartDate()) {
Expand Down Expand Up @@ -241,7 +240,7 @@ public String getAssignmentLikeName(AssignmentDTO existingAssignment) throws Seg

@Override
public String getAssignmentLikeUrl(AssignmentDTO existingAssignment) {
return String.format("https://%s/assignment/%s",
return String.format("https://%s/assignment/%s?utm_source=notification-email",
properties.getProperty(HOST_NAME),
existingAssignment.getGameboardId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public String getAssignmentLikeName(QuizAssignmentDTO assignment) {

@Override
public String getAssignmentLikeUrl(QuizAssignmentDTO assignment) {
return String.format("https://%s/test/assignment/%s",
return String.format("https://%s/test/assignment/%s?utm_source=notification-email",
properties.getProperty(HOST_NAME),
assignment.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ private void startSingleScheduledAssignment(final AssignmentDTO assignment) {
if (sendAssignmentEmail) {
try {
GameboardDTO gameboard = this.gameManager.getGameboard(assignment.getGameboardId());
final String gameboardURL = String.format("https://%s/assignment/%s", this.properties.getProperty(HOST_NAME),
gameboard.getId());
final String gameboardURL = String.format("https://%s/assignment/%s?utm_source=notification-email",
this.properties.getProperty(HOST_NAME), gameboard.getId());
this.emailService.sendAssignmentEmailToGroup(assignment, gameboard, ImmutableMap.of("gameboardURL", gameboardURL),
"email-template-group-assignment");
} catch (SegueDatabaseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void startSingleScheduledQuizAssignment(final QuizAssignmentDTO quizAssi
if (sendAssignmentEmail) {
try {
IsaacQuizDTO quiz = quizManager.findQuiz(quizAssignment.getQuizId());
String quizURL = String.format("https://%s/test/assignment/%s", properties.getProperty(HOST_NAME), quizAssignment.getId());
String quizURL = String.format("https://%s/test/assignment/%s?utm_source=notification-email", properties.getProperty(HOST_NAME), quizAssignment.getId());
emailService.sendAssignmentEmailToGroup(quizAssignment, quiz, ImmutableMap.of("quizURL", quizURL),
"email-template-group-quiz-assignment");
} catch (SegueDatabaseException | ContentManagerException e) {
Expand Down

0 comments on commit 4787f9c

Please sign in to comment.