diff --git a/README.md b/README.md index 01a203a..5c82487 100644 --- a/README.md +++ b/README.md @@ -164,12 +164,12 @@ Generated tracking code should look like: ``` -Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID`. Take the inital root host of `src` as `UMAMI_APP_URL`, and the name of the script (i.e. `umami.js` or `script.js`) as `UMAMI_SCRIPT_NAME`. +Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID`. Take the initial root host of `src` as `UMAMI_APP_URL`, and the name of the script (i.e. `umami.js` or `script.js`) as `UMAMI_SCRIPT_NAME`. Sample event for YouTube button. ```javascript - window.umami('youtube-button'); + window.umami.track('youtube-button'); ``` #### Matomo diff --git a/docs/analytics.md b/docs/analytics.md index 30ff59f..30713db 100644 --- a/docs/analytics.md +++ b/docs/analytics.md @@ -27,7 +27,7 @@ Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID`. Take the inita Sample event for YouTube button. ```javascript - window.umami('youtube-button'); + window.umami.track('youtube-button'); ``` ### Matomo diff --git a/src/analytics/__test__/umami.test.js b/src/analytics/__test__/umami.test.js index d766304..967f477 100644 --- a/src/analytics/__test__/umami.test.js +++ b/src/analytics/__test__/umami.test.js @@ -6,7 +6,9 @@ describe('umami.js', () => { const originalWindow = { ...window }; windowSpy.mockImplementation(() => ({ ...originalWindow, - umami: mockedUmami, + umami: { + track: mockedUmami, + }, })); it('should call umami with event', () => { trackUmamiEvent('youtube-button'); diff --git a/src/analytics/umami.js b/src/analytics/umami.js index f092ff9..fd90cc7 100644 --- a/src/analytics/umami.js +++ b/src/analytics/umami.js @@ -1,3 +1,3 @@ export function trackUmamiEvent(event) { - window.umami(event); + window.umami.track(event); }