Skip to content

Commit

Permalink
Merge pull request #1084 from PiwikPRO/18.4
Browse files Browse the repository at this point in the history
18.4
  • Loading branch information
kororokke authored Oct 23, 2023
2 parents 7f19254 + 4113338 commit f1ea90b
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 63 deletions.
6 changes: 3 additions & 3 deletions _static/js/versionlinks.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//CHANGE VERSION BEFORE NEW RELEASE
if(document.location.pathname.indexOf('/en/latest') === 0) {
document.querySelector('.rst-current-version').innerHTML = document.querySelector('.rst-current-version').innerHTML.replace('v: latest', 'v: latest (18.3)')
document.querySelector('.rst-current-version').innerHTML = document.querySelector('.rst-current-version').innerHTML.replace('v: latest', 'v: latest (18.4)')
}

if(document.querySelector('.injected')){
document.querySelector('.injected > dl:nth-child(1) > dd:nth-child(2) > a').innerText = 'latest (18.3)';
document.querySelector('.injected > dl:nth-child(1) > dd:nth-child(2) > a').innerText = 'latest (18.4)';
} else {
let observer = new MutationObserver(() => {
if (document.querySelector('.injected')) {
document.querySelector('.injected > dl:nth-child(1) > dd:nth-child(2) > a').innerText = 'latest (18.3)';
document.querySelector('.injected > dl:nth-child(1) > dd:nth-child(2) > a').innerText = 'latest (18.4)';
observer.disconnect();
}
});
Expand Down
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
# built documents.
#
# The short X.Y version.
version = u'18.3'
version = u'18.4'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
16 changes: 14 additions & 2 deletions data_collection/api/tracking_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,10 +1023,10 @@ paths:
type: string
format: SemVer
example: 3.4.1
- name: fp
- name: sh
in: query
description: |
Provides on-demand control of the SessionId feature (0=disabled, 1=enabled)
Provides on-demand control of the SessionHash feature (0=disabled, 1=enabled)
When this parameter is not used, processing service will default to the current value from the Privacy tab in global or app settings.
schema:
Expand All @@ -1035,6 +1035,18 @@ paths:
- 0
- 1
example: 1
- name: rmip
in: query
description: |
Forces tracker to erase IP information from `cip` query parameter, common headers and socket address when provided with value `1`.
The erasure happens before the processing, so that IP information is not stored.
schema:
type: integer
enum:
- 0
- 1
example: 1
responses:
202:
description: Request accepted and waiting for processing
Expand Down
109 changes: 53 additions & 56 deletions data_collection/web/frameworks/Piwik_PRO_Library_for_NextJS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,49 +38,31 @@ yarn add @piwikpro/next-piwik-pro

### Basic setup


Some Next.js project have problems with importing ESM libraries. To handle that you need to install `next-transpile-modules` lib.

```
npm install --save next-transpile-modules
```

Then you need to make some adaptions in your `next.config.js` file. Please adapt your file as example below. If it's no exist please create it in main project directory.

##### next.config.json

```ts
/** @type {import('next').NextConfig} */

const withTM = require('next-transpile-modules')(['@piwikpro/next-piwik-pro'])

const nextConfig = {
/* Your Next.js config */
}

module.exports = withTM(nextConfig)

```

In your Next.js Project, include the default `PiwikProProvider` in the `_app.tsx` file. To set up the Piwik PRO Tag Manager container in the app, include the initialization code in your `App`.
In your Next.js Project, include the default `PiwikProProvider` in the `layout.tsx` file. To set up the Piwik PRO Tag Manager container in the app.

In the arguments, pass your container id and your container url as parameters (marked `container-id` and `container-url` in the example below).

#### \_app.tsx
#### layout.tsx

```ts
'use client'

import PiwikProProvider from '@piwikpro/next-piwik-pro'

function App({ Component, pageProps }: AppProps) {
export default function RootLayout({ children }: {
children: React.ReactNode
}) {
return (
<>
<PiwikProProvider
containerId='0a0b8661-8c10-4d59-e8fg-1h926ijkl184'
containerUrl='https://example.piwik.pro'
>
<Component {...pageProps} />
</PiwikProProvider>
</>
<html lang="en">
<body>
<PiwikProProvider
containerId="container-id"
containerUrl="container-url"
>
{children}
</PiwikProProvider>
</body>
</html>
)
}
```
Expand All @@ -96,22 +78,31 @@ NEXT_PUBLIC_CONTAINER_ID=0a0b8661-8c10-4d59-e8fg-1h926ijkl184
NEXT_PUBLIC_CONTAINER_URL=https://example.piwik.pro
```

#### \_app.tsx
#### layout.tsx

```ts
function App({ Component, pageProps }: AppProps) {
'use client'

import PiwikProProvider from '@piwikpro/next-piwik-pro'

export default function RootLayout({ children }: {
children: React.ReactNode
}) {
return (
<>
<PiwikProProvider
containerId={process.env.NEXT_PUBLIC_CONTAINER_ID}
containerUrl={process.env.NEXT_PUBLIC_CONTAINER_URL}
>
<Component {...pageProps} />
</PiwikProProvider>
</>
<html lang="en">
<body>
<PiwikProProvider
containerUrl={process.env.NEXT_PUBLIC_CONTAINER_URL}
containerId={process.env.NEXT_PUBLIC_CONTAINER_ID}
>
{children}
</PiwikProProvider>
</body>
</html>
)
}
```
```
> Previously, we used 'accountName' to configure PiwikProProvider. The parameter has now been replaced by 'container-url'. The 'accountName' parameter is deprecated and will be removed in the future.
```

Expand All @@ -121,22 +112,28 @@ The nonce attribute is useful to allow-list specific elements, such as a particu

If you want your nonce to be passed to the script, pass it as the third argument when calling the script initialization method.

#### \_app.tsx
#### layout.tsx

```ts
'use client'

import PiwikProProvider from '@piwikpro/next-piwik-pro'

function App({ Component, pageProps }: AppProps) {
export default function RootLayout({ children }: {
children: React.ReactNode
}) {
return (
<>
<PiwikProProvider
containerId='container-id'
containerUrl='container-url'
nonce='nonce-string'
>
<Component {...pageProps} />
</PiwikProProvider>
</>
<html lang="en">
<body>
<PiwikProProvider
containerId="container-id"
containerUrl="container-url"
nonce="nonce-string"
>
{children}
</PiwikProProvider>
</body>
</html>
)
}
```
Expand Down
33 changes: 33 additions & 0 deletions platform/authorized_api/tracker_settings/public_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ components:
- strip_site_search_query_parameters
- tracking_fingerprint_disabled
- trust_visitors_cookies
- use_session_hash
- use_anonymous_session_hash
- url_query_parameter_to_exclude_from_url
- urls
responses:
Expand Down Expand Up @@ -314,6 +316,10 @@ components:
$ref: '#/components/schemas/TrackingFingerprintDisabled'
trust_visitors_cookies:
$ref: '#/components/schemas/TrustVisitorsCookies'
use_session_hash:
$ref: '#/components/schemas/UseSessionHash'
use_anonymous_session_hash:
$ref: '#/components/schemas/UseAnonymousSessionHash'
url_query_parameter_to_exclude_from_url:
$ref: '#/components/schemas/UrlQueryParameterToExcludeFromUrl'
urls:
Expand Down Expand Up @@ -390,6 +396,10 @@ components:
$ref: '#/components/schemas/TrackingFingerprintDisabled'
trust_visitors_cookies:
$ref: '#/components/schemas/TrustVisitorsCookies'
use_session_hash:
$ref: '#/components/schemas/UseSessionHash'
use_anonymous_session_hash:
$ref: '#/components/schemas/UseAnonymousSessionHash'
url_query_parameter_to_exclude_from_url:
$ref: '#/components/schemas/UrlQueryParameterToExcludeFromUrl'
updated_at:
Expand Down Expand Up @@ -616,14 +626,37 @@ components:

TrustVisitorsCookies:
type: boolean
deprecated: true
description: |
DEPRECATED! Use `use_session_hash` / `use_anonymous_session_hash` instead.
When enabled, session events wont be matched by a device fingerprint. Only vistor side generated `_id` paramater will be taken into account.
```
Initial global value:
false
```
example: false

UseSessionHash:
type: boolean
description: |
When enabled, session events that are tracked non-anonymously will be matched by a Session Hash. When disabled only vistor side generated `_id` paramater will be taken into account.
```
Initial global value:
true
```
example: true

UseAnonymousSessionHash:
type: boolean
description: |
When enabled, session events that are tracked anonymously will be matched by a Session Hash. When disabled only vistor side generated `_id` paramater will be taken into account.
```
Initial global value:
true
```
example: true

CampaignNameParams:
type: array
description: |
Expand Down
2 changes: 1 addition & 1 deletion requirements.local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Sphinx==1.8.5
sphinxcontrib-httpdomain==1.7.0
commonmark==0.8.1
recommonmark==0.5.0
jinja2<3.1.0
jinja2==3.0.0
# Overwritten with requirements.txt
# sphinx_rtd_theme
-r requirements.txt

0 comments on commit f1ea90b

Please sign in to comment.