Skip to content
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 src/Scripts/AnalyticsScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function attributes(): array
'data-mode' => Setting::boolean(SettingName::HASH_MODE) ? 'hash' : null,
'data-collect-dnt' => Setting::boolean(SettingName::COLLECT_DNT) ? 'true' : null,
'data-ignore-pages' => Setting::get(SettingName::IGNORE_PAGES),
'data-auto-collect' => Setting::get(SettingName::MANUAL_COLLECT) ? 'true' : null,
'data-auto-collect' => Setting::boolean(SettingName::MANUAL_COLLECT) ? 'false' : null,
'data-onload' => Setting::get(SettingName::ONLOAD_CALLBACK),
'data-sa-global' => Setting::get(SettingName::SA_GLOBAL),
'data-hostname' => Setting::get(SettingName::HOSTNAME),
Expand Down
8 changes: 7 additions & 1 deletion tests/Browser/pluginSettings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,14 @@ test('adds a script with manually collect page views enabled', async ({ page, br
await expect(page.locator('[name="simpleanalytics_manual_collect"]')).toBeChecked();

const guest = await visitAsGuest(browser);
expect(await guest.content()).toContain('data-auto-collect="true"');
await expect(guest.locator(DEFAULT_SCRIPT_SELECTOR)).toHaveAttribute('data-auto-collect', 'false');
await guest.context().close();

await page.locator('[name="simpleanalytics_manual_collect"]').uncheck();
await saveSettings(page);
const automaticGuest = await visitAsGuest(browser);
await expect(automaticGuest.locator(DEFAULT_SCRIPT_SELECTOR)).not.toHaveAttribute('data-auto-collect');
await automaticGuest.context().close();
});

test('adds a script with overwrite domain name', async ({ page, browser }) => {
Expand Down