Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 2321e04

Browse files
authored
Merge pull request #1135 from PiwikPRO/18.13
18.13
2 parents 5b28888 + a6f82ef commit 2321e04

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Piwik PRO Library for VUE
2+
3+
Dedicated Piwik PRO library that helps with implementing Piwik PRO Tag Manager and the Piwik PRO tracking client in VUE applications.
4+
5+
* [Installation](#installation)
6+
* [NPM](#npm)
7+
* [Basic setup](#basic-setup)
8+
* [Setup with nonce](#setup-with-nonce)
9+
10+
## Installation
11+
12+
### NPM
13+
14+
To use this package in your project, run the following command.
15+
16+
```
17+
npm install @piwikpro/vue-piwik-pro
18+
```
19+
20+
21+
### Basic setup
22+
23+
In your Vue Project, include the default `PiwikPro` in the highest level application module. ie `main`. To set up the Piwik PRO Tag Manager container in the app, the easiest way is to call the `PiwikPro.initialize()` method. `PiwikPro.initialize()` must be initialized using this function before any of the other tracking functions will record any data.
24+
25+
In the arguments, pass your app ID and your account URL as parameters (marked 'container-id' and 'container-url' in the example below).
26+
27+
```ts
28+
// main.ts
29+
import VuePiwikPro from '@piwikpro/vue-piwik-pro'
30+
31+
VuePiwikPro.initialize(
32+
import.meta.env.VITE_PIWIK_PRO_CONTAINER_ID as string,
33+
import.meta.env.VITE_PIWIK_PRO_CONTAINER_URL as string
34+
)
35+
```
36+
37+
### Setup with nonce
38+
39+
The nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-list all inline scripts or styles.
40+
41+
If you want your nonce to be passed to the script, pass it as the third argument when calling the script initialization method.
42+
43+
```ts
44+
// main.ts
45+
import VuePiwikPro from '@piwikpro/vue-piwik-pro'
46+
47+
VuePiwikPro.initialize(
48+
import.meta.env.VITE_PIWIK_PRO_CONTAINER_ID as string,
49+
import.meta.env.VITE_PIWIK_PRO_CONTAINER_URL as string,
50+
'nonce-string'
51+
)
52+
```
53+
54+
## Examples of usage
55+
56+
Please explore the ```./vue-piwik-pro-example``` directory of the [Vue repository](https://github.com/PiwikPRO/vue-piwik-pro/tree/master/vue-piwik-pro-example) to get to know how to use this package with a specyfic examples and it's various methods.

data_collection/web/frameworks/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ Frameworks
77

88
Piwik_PRO_Library_for_Angular.md
99
Piwik_PRO_Library_for_React.md
10+
Piwik_PRO_Library_for_Vue.md
1011
Piwik_PRO_Library_for_NextJS.md
1112
Piwik_PRO_Plugin_for_Gatsby.md

0 commit comments

Comments
 (0)