Skip to content

Commit

Permalink
EventsSDK: Update ReadMe with new AnalyticsConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Jaffee committed Feb 1, 2024
1 parent 8b14741 commit d58a15d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ Next, import and initialize the library in your application. When initializing y
import { analytics } from '@yext/analytics';

// Root analytics service with no defaults.
const rootAnalytics = analytics({ key: 'MY_API_KEY' });
const rootAnalytics = analytics({
authorizationType: 'apiKey',
authorization: 'MY_API_KEY'
});
```

In many cases, you might need to repeatedly specify the same properties, such as a Pages site ID or Chat bot ID. Yext Analytics allows you to avoid having to repeatedly specify the same code by allowing you to set **default values**.
Expand All @@ -49,7 +52,10 @@ You can add a `.with()` method to the root analytics service you initialized, wh
import { analytics } from '@yext/analytics';

// Root analytics service with no defaults.
const rootAnalytics = analytics({ key: 'MY_API_KEY' });
const rootAnalytics = analytics({
authorizationType: 'apiKey',
authorization: 'MY_API_KEY'
});

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

0 comments on commit d58a15d

Please sign in to comment.