{"id":29946091,"url":"https://github.com/wingify/vwo-smartcode-nextjs","last_synced_at":"2026-01-20T17:35:40.128Z","repository":{"id":280405893,"uuid":"939369302","full_name":"wingify/vwo-smartcode-nextjs","owner":"wingify","description":"React component to integrate VWO smart-code into Next.js applications","archived":false,"fork":false,"pushed_at":"2025-04-11T07:39:27.000Z","size":55,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-08-11T01:33:32.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vwo-smartcode-nextjs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wingify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-26T12:36:38.000Z","updated_at":"2025-04-11T07:39:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"e50259ee-baae-471f-9fb9-9bdaf4b8a81d","html_url":"https://github.com/wingify/vwo-smartcode-nextjs","commit_stats":null,"previous_names":["wingify/vwo-smartcode-nextjs"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wingify/vwo-smartcode-nextjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-smartcode-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-smartcode-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-smartcode-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-smartcode-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wingify","download_url":"https://codeload.github.com/wingify/vwo-smartcode-nextjs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-smartcode-nextjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858847,"owners_count":25180766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-03T05:12:47.176Z","updated_at":"2026-01-20T17:35:40.122Z","avatar_url":"https://github.com/wingify.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js component for VWO SmartCode integration\n\n[![npm version](https://img.shields.io/npm/v/vwo-smartcode-nextjs?style=for-the-badge\u0026color=grey\u0026logo=npm)](https://www.npmjs.com/package/vwo-smartcode-nextjs)\n\n## Overview\n\nThe **VWO SmartCode Next.js** package enables seamless integration of **VWO SmartCode** into Next.js applications. This component is designed to work with both **Page Router** and **App Router**, allowing developers to integrate VWO SmartCode efficiently.\n\n## Installation\n\nInstall the package using npm or yarn:\n\n```bash\n# via npm\nnpm install vwo-smartcode-nextjs\n\n# via yarn\nyarn add vwo-smartcode-nextjs\n```\n\n## Usage\n\n### Page Router (Legacy `pages/` Directory)\n\nFor applications using the **Page Router**, add the `VWOScript` component inside `_document.js` (or `_document.tsx` if using TypeScript) to include it in the `\u003chead\u003e` of your HTML document.\n\n```javascript\n// pages/_document.js\nimport Document, { Html, Head, Main, NextScript } from 'next/document';\nimport { VWOScript } from 'vwo-smartcode-nextjs';\n\nclass MyDocument extends Document {\n  render() {\n    return (\n      \u003cHtml\u003e\n        \u003cHead\u003e\n          \u003cVWOScript accountId=\"YOUR_ACCOUNT_ID\" /\u003e\n        \u003c/Head\u003e\n        \u003cbody\u003e\n          \u003cMain /\u003e\n          \u003cNextScript /\u003e\n        \u003c/body\u003e\n      \u003c/Html\u003e\n    );\n  }\n}\n\nexport default MyDocument;\n```\n\n### App Router (`app/` Directory)\n\nFor applications using the **App Router**, include the `VWOScript` component in `layout.tsx` to ensure it loads correctly within the `\u003chead\u003e` of your HTML document.\n\n```tsx\n// app/layout.tsx\nimport { VWOScript } from 'vwo-smartcode-nextjs';\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    \u003chtml lang=\"en\"\u003e\n      \u003chead\u003e\n        \u003cVWOScript accountId=\"YOUR_ACCOUNT_ID\" /\u003e\n      \u003c/head\u003e\n      \u003cbody\u003e{children}\u003c/body\u003e\n    \u003c/html\u003e\n  );\n}\n```\n\n### Using Nonce\n\nTo add a nonce attribute for Content Security Policy:\n\n```tsx\n\u003cVWOScript\n  accountId=\"YOUR_ACCOUNT_ID\"\n  scriptAttributes={{\n    nonce: 'your-nonce-value',\n  }}\n/\u003e\n```\n\n## Props\n\nThe `VWOScript` component accepts the following props:\n\n| Prop               | Type                     | Required | Default                                                                                | Description                                         |\n| ------------------ | ------------------------ | -------- | -------------------------------------------------------------------------------------- | --------------------------------------------------- |\n| `accountId`        | `string`                 | ✅ Yes   | `null`                                                                                 | Your VWO account ID                                 |\n| `type`             | `'ASYNC' \\| 'SYNC'`      | No       | `'ASYNC'`                                                                              | Type of VWO script loading                          |\n| `settingsTimeout`  | `number`                 | No       | `2000`                                                                                 | Timeout for settings initialization                 |\n| `hideElement`      | `string`                 | No       | `'body'`                                                                               | CSS selector for the element to be hidden           |\n| `hideElementStyle` | `string`                 | No       | `'opacity:0 !important;filter:alpha(opacity=0) !important;background:white !important;transition:none !important;'` | CSS styles applied to the hidden element            |\n| `backgroundColor`  | `string`                 | No       | `'white'`                                                                              | Background color used when hiding body element      |\n| `scriptAttributes` | `Record\u003cstring, string\u003e` | No       | `{}`                                                                                   | Additional attributes to be added to the script tag. Note: `id` will be overridden and `referrerPolicy` will be overridden in case of `SYNC` SmartCode |\n| `linkAttributes`   | `Record\u003cstring, string\u003e` | No       | `{}`                                                                                   | Additional attributes to be added to the link tag.  |\n\n\n## Authors\n\n- [Apoorv Tiwari](https://github.com/Ragnarrlothbrok)\n\n## Development and Testing\n\n### Install Dependencies\n\n```bash\nyarn install\n```\n\n### Compile TypeScript to JavaScript\n\n```bash\nyarn build\n```\n\n## Contributing\n\nWe welcome contributions to improve this package! Please read our [contributing guidelines](https://github.com/wingify/vwo-smartcode-nextjs/blob/master/CONTRIBUTING.md) before submitting a PR.\n\n## Code of Conduct\n\nOur [Code of Conduct](https://github.com/wingify/vwo-smartcode-nextjs/blob/master/CODE_OF_CONDUCT.md) outlines expectations for all contributors and maintainers.\n\n## License\n\n[Apache License, Version 2.0](https://github.com/wingify/vwo-smartcode-nextjs/blob/master/LICENSE)\n\n\u0026copy; 2025 Wingify Software Pvt. Ltd.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingify%2Fvwo-smartcode-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwingify%2Fvwo-smartcode-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingify%2Fvwo-smartcode-nextjs/lists"}