Skip to content

Commit

Permalink
Set cookie path to URL of homepage (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgax authored Dec 13, 2023
1 parent 4b76a50 commit fbeed50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wagtail_ab_testing/static/wagtail_ab_testing/js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

// Add this goal page/event into the goals data structure
goals[window.wagtailAbTesting.goalPageId] = goals[window.wagtailAbTesting.goalPageId] || {}
goals[window.wagtailAbTesting.goalPageId] = goals[window.wagtailAbTesting.goalPageId] || {};
goals[window.wagtailAbTesting.goalPageId][window.wagtailAbTesting.goalEvent] = goals[window.wagtailAbTesting.goalPageId][window.wagtailAbTesting.goalEvent] || [];

// Check if this user is already a participant in this test
Expand All @@ -64,7 +64,7 @@
// Put the version into a cookie so that Wagtail continues to serve this version
var expires = new Date();
expires.setFullYear(expires.getFullYear() + 1);
document.cookie = cookieName + '=' + window.wagtailAbTesting.version + '; expires=' + expires.toUTCString();
document.cookie = cookieName + '=' + window.wagtailAbTesting.version + '; path=/; expires=' + expires.toUTCString();

// Store the test ID against the goal event in the goals data structure
// We will use this for knowing when to call the goal reached API later
Expand Down

0 comments on commit fbeed50

Please sign in to comment.