Skip to content

Commit

Permalink
Update documentation (#127)
Browse files Browse the repository at this point in the history
Update README.md to `import { analytics } from "@yext/analytics"`
instead of `import { Analytics }...`, and remove usages of `new`.

J=FUS-6200
TEST=manual

Since the test site does `import { analytics } from "@yext/analytics"`,
and calls the analytics function without using the `new` keyword, I ran
the test site and confirmed that clicking the buttons successfully fired
analytics events.
  • Loading branch information
swong1213 committed Jan 26, 2024
1 parent e5bd3d6 commit 4286541
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ In many cases, you might need to repeatedly specify the same properties, such as
You can add a `.with()` method to the root analytics service you initialized, which returns a new analytics object with the specified JSON merged on top of the existing defaults.

```ts
import { Analytics } from '@yext/analytics';
import { analytics } from '@yext/analytics';

// Root analytics service with no defaults.
const rootAnalytics = new Analytics({ key: 'MY_API_KEY' });
const rootAnalytics = analytics({ key: 'MY_API_KEY' });

// Pages analytics service with Pages defaults.
const pageAnalytics = rootAnalytics.with({ pages: { siteId: 123 } });
Expand Down

0 comments on commit 4286541

Please sign in to comment.