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

Set cookie path to URL of homepage #67

Merged
merged 2 commits into from
Dec 13, 2023
Merged
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
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