Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add userParams prop in yaMetrika init #24

Merged
merged 7 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ app.get((req, res) => {
renderLayout({
title: 'Home page',
pluginsOptions: {
yandexMetrica: {
yandexMetrika: {
counter: {
id: 123123123,
defer: true,
Expand Down Expand Up @@ -359,6 +359,9 @@ export interface MetrikaCounter {
trackHash?: boolean;
ecommerce?: boolean | string;
type?: number;
userParams?: {
[x: string]: boolean | string | number;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update readme and add UserParams in export

}

export type MetrikaOptions = {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/yandex-metrika/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function renderMetrika(params: MetrikaPluginOptions, utils: RenderHelpers
ecommerce: ${config.ecommerce},
type: ${Number(config.type)},
experiments: "${config.encryptedExperiments || ''}"
userParams: ${JSON.stringify(config?.userParams || {})}
NikitaCG marked this conversation as resolved.
Show resolved Hide resolved
});
`,
)
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/yandex-metrika/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export interface MetrikaCounter {
ecommerce?: boolean | string;
/** @default 0 */
type?: number;
/** @default {} */
userParams?: {
[x: string]: boolean | string | number;
};
ValeraS marked this conversation as resolved.
Show resolved Hide resolved
}

export type MetrikaPluginOptions = {
Expand Down
Loading