Skip to content

Commit

Permalink
Merge pull request #10 from PiwikPRO/docs/remove-tips-tags
Browse files Browse the repository at this point in the history
Remove TIP tags from README_BASE.md
  • Loading branch information
auto200 authored Jul 30, 2024
2 parents 0b12aa8 + 8f1c65e commit 17356dd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 52 deletions.
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ If you want your nonce to be passed to the script, pass it as the third argument

Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`.

> [!IMPORTANT]
> Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side.
###### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side.

```ts
// In any component or other part of application code
Expand All @@ -79,32 +78,34 @@ To use Piwik PRO services safety, you can import `usePiwikPro()` from `'@piwikpr
// In any component or other part of application code
import { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
// callback can be sync or async function
const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
});
const userId = await usePiwikPro(
({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
}
);
```

> [!TIP]
>
> ###### export `usePiwikPro()` as a Nuxt composable
>
> To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`.
>
> ```ts
> // composables/usePiwikPro.ts
> export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
> ```
>
> ```ts
> // In any component or other part of application code
> const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => {
> PageViews.trackPageView();
> GoalConversions.trackGoal(1, 100);
> return UserManagement.getUserId();
> });
> ```
###### export `usePiwikPro()` as a Nuxt composable

To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`.

```ts
// composables/usePiwikPro.ts
export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
```

```ts
// In any component or other part of application code
const userId = await usePiwikPro(
({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
}
);
```

##### Usage with `<ClientOnly/>` Nuxt component

Expand Down
53 changes: 27 additions & 26 deletions docs/README_BASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ If you want your nonce to be passed to the script, pass it as the third argument

Piwik PRO container will be initialized under the hood by `@piwikpro/nuxt-piwik-pro` module itself. Module also inject client-only plugin to Nuxt application instance which allow you to use all Piwik PRO services globally as a part of Nuxt context returned from `useNuxtApp()` composable as a `$piwikPRO`.

> [!IMPORTANT]
> Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side.
##### Remember that Piwik PRO is a client-only library. This means you won't have access to any of its services on the server side.

```ts
// In any component or other part of application code
Expand All @@ -75,32 +74,34 @@ To use Piwik PRO services safety, you can import `usePiwikPro()` from `'@piwikpr
// In any component or other part of application code
import { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
// callback can be sync or async function
const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
});
const userId = await usePiwikPro(
({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
}
);
```

> [!TIP]
>
> ###### export `usePiwikPro()` as a Nuxt composable
>
> To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`.
>
> ```ts
> // composables/usePiwikPro.ts
> export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
> ```
>
> ```ts
> // In any component or other part of application code
> const userId = await usePiwikPro(({ PageViews, GoalConversions, UserManagement }) => {
> PageViews.trackPageView();
> GoalConversions.trackGoal(1, 100);
> return UserManagement.getUserId();
> });
> ```
##### export `usePiwikPro()` as a Nuxt composable

To make this composable globally available, create `.ts` file in `/composables` directory and export `usePiwikPro()` from `'@piwikpro/nuxt-piwik-pro/composables'`.

```ts
// composables/usePiwikPro.ts
export { usePiwikPro } from "@piwikpro/nuxt-piwik-pro/composables";
```

```ts
// In any component or other part of application code
const userId = await usePiwikPro(
({ PageViews, GoalConversions, UserManagement }) => {
PageViews.trackPageView();
GoalConversions.trackGoal(1, 100);
return UserManagement.getUserId();
}
);
```

#### Usage with `<ClientOnly/>` Nuxt component

Expand Down

0 comments on commit 17356dd

Please sign in to comment.