customCrossDomainLinkDecorator
The customCrossDomainLinkDecorator() method sets a function that adds custom query parameter that passes a visitor ID parameter when domains are linked. The default function adds a linking value as a parameter named pk_vid
.
This function is used only when you use enableCrossDomainLinking().
Syntax
customCrossDomainLinkDecorator(urlDecorator)
customCrossDomainLinkDecorator(urlDecorator): void
customCrossDomainLinkDecorator(urlDecorator): void
customCrossDomainLinkDecorator(urlDecorator): void
customCrossDomainLinkDecorator(urlDecorator): void
customCrossDomainLinkDecorator(urlDecorator): void
customCrossDomainLinkDecorator(urlDecorator): void
Parameters
urlDecorator (function, required)
Defines parameters that are used to hold the visitor ID when domains are linked.
urlDecorator(url, value, name)
The urlDecorator() method accepts a URL, value and name, and then returns the decorated URL.
url (string, required)
The page URL.
value (string, required)
The visitor ID that should be passed via the URL.
name (string, required)
The name of the visitor ID used in Piwik PRO. It can be customized.
Returns
A decorated URL or null.
Format: Example: https://example.com?pk_vid=36
Type: string | null
Examples
_paq.push(["customCrossDomainLinkDecorator", function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
}]);
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
CrossDomainTracking.customCrossDomainLinkDecorator(function (url, value, name) {
var parsedUrl = new URL(url);
parsedUrl.searchParams.append(name, value);
return parsedUrl.href;
});
Related methods
Updated 6 days ago