Skip to content

Commit

Permalink
Merge latest
Browse files Browse the repository at this point in the history
  • Loading branch information
apata committed Nov 5, 2024
2 parents 8c8bb1c + 1e1a4ab commit a4de6dd
Show file tree
Hide file tree
Showing 127 changed files with 4,776 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Taht
taht
referer
referers

statics
10 changes: 5 additions & 5 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ env:

jobs:
build:
name: "Build and test (${{ matrix.mix_env }}, ${{ matrix.postgres_image }}${{ matrix.test_experimental_reduced_joins == '1' && ', experimental_reduced_joins' || '' }})"
name: "Build and test (${{ matrix.mix_env }}, ${{ matrix.postgres_image }}${{ matrix.test_read_team_schemas_and_experimental_reduced_joins == '1' && ', read_team_schemas_and_experimental_reduced_joins' || '' }})"
runs-on: ubuntu-latest
strategy:
matrix:
mix_env: ["test", "ce_test"]
postgres_image: ["postgres:16"]
test_experimental_reduced_joins: ["0"]
test_read_team_schemas_and_experimental_reduced_joins: ["0"]

include:
- mix_env: "test"
postgres_image: "postgres:15"
test_experimental_reduced_joins: "0"
test_read_team_schemas_and_experimental_reduced_joins: "0"
- mix_env: "test"
postgres_image: "postgres:16"
test_experimental_reduced_joins: "1"
test_read_team_schemas_and_experimental_reduced_joins: "1"

env:
MIX_ENV: ${{ matrix.mix_env }}
TEST_EXPERIMENTAL_REDUCED_JOINS: ${{ matrix.test_experimental_reduced_joins }}
TEST_READ_TEAM_SCHEMAS_AND_EXPERIMENTAL_REDUCED_JOINS: ${{ matrix.test_read_team_schemas_and_experimental_reduced_joins }}
services:
postgres:
image: ${{ matrix.postgres_image }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
- run: npm run check-format --prefix ./assets
- run: npm run test --prefix ./assets
- run: npm run deploy --prefix ./tracker
- run: npm run report-sizes --prefix ./tracker
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ npm-debug.log
/assets/node_modules/
/tracker/node_modules/

# Files generated by Playwright when running tracker tests
/tracker/test-results/
/tracker/playwright-report/
/tracker/blob-report/
/tracker/playwright/.cache/

# Stored hash of source tracker files used in development environment
# to detect changes in /tracker/src and avoid unnecessary compilation.
/tracker/dev-compile/last-hash.txt

# test coverage directory
/assets/coverage

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
## Unreleased

### Added
- Dashboard shows comparisons for all reports

### Removed
### Changed
### Fixed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
<br /><br />
</p>

[Plausible Analytics](https://plausible.io/) is an easy to use, lightweight (< 1 KB), open source and privacy-friendly alternative to Google Analytics. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR. You can self-host Plausible Community Edition or have us manage Plausible Analytics for you in the cloud. Here's [the live demo of our own website stats](https://plausible.io/plausible.io). Made and hosted in the EU 🇪🇺
[Plausible Analytics](https://plausible.io/) is an easy to use, lightweight, open source and privacy-friendly alternative to Google Analytics. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR. You can self-host Plausible Community Edition or have us manage Plausible Analytics for you in the cloud. Here's [the live demo of our own website stats](https://plausible.io/plausible.io). Made and hosted in the EU 🇪🇺

We are dedicated to making web analytics more privacy-friendly. Our mission is to reduce corporate surveillance by providing an alternative web analytics tool which doesn’t come from the AdTech world. We are completely independent and solely funded by our subscribers.

![Plausible Analytics](https://plausible.io/docs/img/plausible-analytics.png)

## Why Plausible?

Here's what makes Plausible a great Google Analytics alternative and why we're trusted by 12,000+ paying subscribers to deliver their website and business insights:
Here's what makes Plausible a great Google Analytics alternative and why we're trusted by thousands of paying subscribers to deliver their website and business insights:

- **Clutter Free**: Plausible Analytics provides [simple web analytics](https://plausible.io/simple-web-analytics) and it cuts through the noise. No layers of menus, no need for custom reports. Get all the important insights on one single page. No training necessary.
- **GDPR/CCPA/PECR compliant**: Measure traffic, not individuals. No personal data or IP addresses are ever stored in our database. We don't use cookies or any other persistent identifiers. [Read more about our data policy](https://plausible.io/data-policy)
- **Lightweight**: Plausible Analytics works by loading a script on your website, like Google Analytics. Our script is [45x smaller](https://plausible.io/lightweight-web-analytics), making your website quicker to load. You can also send events directly to our [events API](https://plausible.io/docs/events-api).
- **Lightweight**: Plausible Analytics works by loading a script on your website, like Google Analytics. Our script is [small](https://plausible.io/lightweight-web-analytics), making your website quicker to load. You can also send events directly to our [events API](https://plausible.io/docs/events-api).
- **Email or Slack reports**: Keep an eye on your traffic with weekly and/or monthly email or Slack reports. You can also get traffic spike notifications.
- **Invite team members and share stats**: You have the option to be transparent and open your web analytics to everyone. Your website stats are private by default but you can choose to make them public so anyone with your custom link can view them. You can [invite team members](https://plausible.io/docs/users-roles) and assign user roles too.
- **Define key goals and track conversions**: Create custom events with custom dimensions to track conversions and attribution to understand and identify the trends that matter. Includes easy ways to track outbound link clicks, file downloads and 404 error pages.
- **Define key goals and track conversions**: Create custom events with custom dimensions to track conversions and attribution to understand and identify the trends that matter. Track ecommerce revenue, outbound link clicks, file downloads and 404 error pages. Increase conversions using funnel analysis.
- **Search keywords**: Integrate your dashboard with Google Search Console to get the most accurate reporting on your search keywords.
- **SPA support**: Plausible is built with modern web frameworks in mind and it works automatically with any pushState based router on the frontend. We also support frameworks that use the URL hash for routing. See [our documentation](https://plausible.io/docs/hash-based-routing).
- **Smooth transition from Google Analytics**: There's a realtime dashboard, entry pages report and integration with Search Console. You can track your paid campaigns and conversions. You can invite team members. You can even [import your historical Google Analytics stats](https://plausible.io/docs/google-analytics-import). Learn how to [get the most out of your Plausible experience](https://plausible.io/docs/your-plausible-experience) and join thousands who have already migrated from Google Analytics.
Expand Down
1 change: 0 additions & 1 deletion assets/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"globals": {
"BUILD_EXTRA": true
},
"setupFiles": ["<rootDir>/test-utils/set-fixed-timezone.ts"],
"setupFilesAfterEnv": [
"<rootDir>/test-utils/extend-expect.ts",
"<rootDir>/test-utils/reset-state.ts"
Expand Down
81 changes: 81 additions & 0 deletions assets/js/dashboard/date-range-calendar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/** @format */

import React from 'react'
import { render, screen } from '@testing-library/react'
import { DateRangeCalendar } from './date-range-calendar'
import userEvent from '@testing-library/user-event'

test('renders with default dates in view, respects max and min dates', async () => {
const onCloseWithNoSelection = jest.fn()
const onCloseWithSelection = jest.fn()
const handlers = { onCloseWithNoSelection, onCloseWithSelection }

render(
<DateRangeCalendar
minDate="2024-09-10"
maxDate="2024-09-25"
defaultDates={['2024-09-12', '2024-09-19']}
{...handlers}
/>
)

const days = await screen.queryAllByLabelText(/, 2024/)

expect(
days.map((d) => [d.getAttribute('aria-label'), d.getAttribute('class')])
).toEqual([
['September 1, 2024', 'flatpickr-day flatpickr-disabled'],
['September 2, 2024', 'flatpickr-day flatpickr-disabled'],
['September 3, 2024', 'flatpickr-day flatpickr-disabled'],
['September 4, 2024', 'flatpickr-day flatpickr-disabled'],
['September 5, 2024', 'flatpickr-day flatpickr-disabled'],
['September 6, 2024', 'flatpickr-day flatpickr-disabled'],
['September 7, 2024', 'flatpickr-day flatpickr-disabled'],
['September 8, 2024', 'flatpickr-day flatpickr-disabled'],
['September 9, 2024', 'flatpickr-day flatpickr-disabled'],
['September 10, 2024', 'flatpickr-day'],
['September 11, 2024', 'flatpickr-day'],
['September 12, 2024', 'flatpickr-day selected startRange'],
['September 13, 2024', 'flatpickr-day inRange'],
['September 14, 2024', 'flatpickr-day inRange'],
['September 15, 2024', 'flatpickr-day inRange'],
['September 16, 2024', 'flatpickr-day inRange'],
['September 17, 2024', 'flatpickr-day inRange'],
['September 18, 2024', 'flatpickr-day inRange'],
['September 19, 2024', 'flatpickr-day selected endRange'],
['September 20, 2024', 'flatpickr-day'],
['September 21, 2024', 'flatpickr-day'],
['September 22, 2024', 'flatpickr-day'],
['September 23, 2024', 'flatpickr-day'],
['September 24, 2024', 'flatpickr-day'],
['September 25, 2024', 'flatpickr-day'],
['September 26, 2024', 'flatpickr-day flatpickr-disabled'],
['September 27, 2024', 'flatpickr-day flatpickr-disabled'],
['September 28, 2024', 'flatpickr-day flatpickr-disabled'],
['September 29, 2024', 'flatpickr-day flatpickr-disabled'],
['September 30, 2024', 'flatpickr-day flatpickr-disabled'],
['October 1, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 2, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 3, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 4, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 5, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 6, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 7, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 8, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 9, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 10, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 11, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled'],
['October 12, 2024', 'flatpickr-day nextMonthDay flatpickr-disabled']
])

const newStart = await screen.getByLabelText('September 20, 2024')
await userEvent.click(newStart)
const newEnd = await screen.getByLabelText('September 25, 2024')
await userEvent.click(newEnd)

expect(onCloseWithSelection).toHaveBeenCalledTimes(1)
expect(onCloseWithSelection).toHaveBeenLastCalledWith([
new Date('2024-09-20'),
new Date('2024-09-25')
])
})
14 changes: 9 additions & 5 deletions assets/js/dashboard/datepicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @format */
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react'
import { formatDateRange, formatISO } from './util/date'
import { formatDateRange, formatISO, nowForSite } from './util/date'
import {
shiftQueryPeriod,
getDateForShiftedPeriod,
Expand Down Expand Up @@ -322,14 +322,16 @@ export default function QueryPeriodPicker() {
() => getCompareLinkItem({ site, query }),
[site, query]
)
const groups = useMemo(() => {

const datePeriodGroups = useMemo(() => {
const groups = getDatePeriodGroups(site)
// add Custom Range link to the last group
groups[groups.length - 1].push(customRangeLink)

if (COMPARISON_DISABLED_PERIODS.includes(query.period)) {
return groups
}
// maybe ass Compare link as another group to the very end
// maybe add Compare link as another group to the very end
return groups.concat([[compareLink]])
}, [site, query, customRangeLink, compareLink])

Expand Down Expand Up @@ -364,14 +366,15 @@ export default function QueryPeriodPicker() {
}}
>
{menuVisible === 'datemenu' && (
<QueryPeriodsMenu groups={groups} closeMenu={closeMenu} />
<QueryPeriodsMenu groups={datePeriodGroups} closeMenu={closeMenu} />
)}
{menuVisible === 'datemenu-calendar' && (
<DateRangeCalendar
onCloseWithSelection={(selection) =>
navigate({ search: getSearchToApplyCustomDates(selection) })
}
minDate={site.statsBegin}
maxDate={formatISO(nowForSite(site))}
defaultDates={
query.to && query.from
? [formatISO(query.from), formatISO(query.to)]
Expand Down Expand Up @@ -415,6 +418,7 @@ export default function QueryPeriodPicker() {
})
}
minDate={site.statsBegin}
maxDate={formatISO(nowForSite(site))}
defaultDates={
query.compare_from && query.compare_to
? [
Expand All @@ -432,7 +436,7 @@ export default function QueryPeriodPicker() {
<>
<ArrowKeybind keyboardKey="ArrowLeft" />
<ArrowKeybind keyboardKey="ArrowRight" />
{groups
{datePeriodGroups
.concat([[last6MonthsLinkItem]])
.flatMap((group) =>
group
Expand Down
Loading

0 comments on commit a4de6dd

Please sign in to comment.