forked from plausible/plausible-tracker
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
31a4690
commit 8310014
Showing
22 changed files
with
2,313 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title> | ||
Auto Outbound Tracking | ||
</title> | ||
</head> | ||
<body> | ||
<!-- | ||
This playground page is meant to be used by the end-to-end tests. Please do not remove any of the following elements. | ||
--> | ||
|
||
<a href="https://example.com">External Link</a> | ||
|
||
<a href="/">Internal Link</a> | ||
|
||
<a href="https://example.com" rel="noopener noreferrer">External Link (noopener noreferrer)</a> | ||
|
||
<a href="https://example.com" target="_blank">External Link (_blank)</a> | ||
|
||
<button id="cleanup">Cleanup</button> | ||
|
||
<script type="module" src="/src/auto-outbound-tracking.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title> | ||
File Downloads Tracking | ||
</title> | ||
</head> | ||
<body> | ||
<!-- | ||
This playground page is meant to be used by the end-to-end tests. Please do not remove any of the following elements. | ||
--> | ||
|
||
<a download href="/file.svg">Download SVG</a> | ||
<a href="/file.svg">Download SVG without download attribute</a> | ||
<a href="/file.svg" target="_blank">Download SVG targeting blank</a> | ||
<a href="https://localhost:5173/file.svg">Download SVG with full URL</a> | ||
|
||
<a download href="/document.pdf">Download PDF</a> | ||
|
||
<a href="/">Simple link</a> | ||
|
||
<button id="cleanup">Cleanup</button> | ||
|
||
<script type="module" src="/src/file-downloads-tracking.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createPlausibleTracker } from '@barbapapazes/plausible-tracker' | ||
import { useAutoOutboundTracking } from '@barbapapazes/plausible-tracker/extensions/auto-outbound-tracking' | ||
|
||
const plausible = createPlausibleTracker({ | ||
ignoredHostnames: [], | ||
}) | ||
|
||
const autoOutboundTracking = useAutoOutboundTracking(plausible) | ||
|
||
autoOutboundTracking.install() | ||
|
||
document.getElementById('cleanup')!.addEventListener('click', () => { | ||
autoOutboundTracking.cleanup() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createPlausibleTracker } from '@barbapapazes/plausible-tracker' | ||
import { useAutoFileDownloadsTracking } from '@barbapapazes/plausible-tracker/extensions/file-downloads-tracking' | ||
|
||
const plausible = createPlausibleTracker({ | ||
ignoredHostnames: [], | ||
}) | ||
|
||
const fileDownloadsTracking = useAutoFileDownloadsTracking(plausible, { | ||
fileTypes: ['svg'], | ||
}) | ||
|
||
fileDownloadsTracking.install() | ||
|
||
document.getElementById('cleanup')!.addEventListener('click', () => { | ||
fileDownloadsTracking.cleanup() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import process from 'node:process' | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// import dotenv from 'dotenv'; | ||
// dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './test/e2e', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
timeout: 5000, | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: 'http://localhost:5173', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
// { | ||
// name: 'webkit', | ||
// use: { ...devices['Desktop Safari'] }, | ||
// }, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'npm run dev', | ||
url: 'http://localhost:5173', | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}) |
Oops, something went wrong.