-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d85905
commit 410b52a
Showing
104 changed files
with
1,841 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Common Services | ||
--- | ||
|
||
Partytown already comes with a few components for commonly used Services. Please see [Services](/services) before manually configuring the `forward` property. | ||
|
||
| Service | Forward Config | | ||
| -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | ||
| [Adobe Launch](https://experienceleague.adobe.com/docs/experience-platform/tags/client-side/satellite-object.html?lang=en) | `"_satellite.track"` | | ||
| [Facebook Pixel](https://www.facebook.com/business/help/952192354843755?id=1205376682832142) | `"fbq"` | | ||
| [Freshpaint](https://documentation.freshpaint.io/) | `"freshpaint.addPageviewProperties","freshpaint.identify","freshpaint.track"` | | ||
| [Google Tag Manager](https://developers.google.com/tag-manager/quickstart) | `"dataLayer.push"` | | ||
| [Hubspot Tracking](https://developers.hubspot.com/docs/api/events/tracking-code) | `"_hsq.push"` | | ||
| [Intercom](https://developers.intercom.com/installing-intercom/docs/intercom-javascript) | `"Intercom"` | | ||
| [Klaviyo](https://developers.klaviyo.com/en/docs/javascript-api) | `"_learnq.push"` | | ||
| [TikTok Pixel](https://ads.tiktok.com/marketing_api/docs?rid=959icq5stjr&id=1701890973258754) | `"ttq.track","ttq.page","ttq.load"` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,63 @@ | ||
--- | ||
title: Copy Library Files | ||
description: Copy Library Files | ||
--- | ||
|
||
The [@builder.io/partytown](https://www.npmjs.com/package/@builder.io/partytown) NPM package provides the static `lib` files that need to be served from your site. Since Partytown is using a service worker, these files must be served from the same origin as your site, and cannot be hosted from a CDN. Each site is different, and how the Partytown `lib` files are hosted depends on individual setup. | ||
|
||
The `/~partytown/` directory should serve the static files found within [@builder.io/partytown/lib](https://cdn.jsdelivr.net/npm/@builder.io/partytown/lib/). The quickest way is to copy the `lib` directory into a public `/~partytown` directory within your static server. Another option would be to set up a copy task within the project's bundler, or create a build step. | ||
|
||
You can also use the [lib config](/configuration) if your site must host these files from a directory other than the default `/~partytown/`. | ||
|
||
### Copy Task Command | ||
|
||
For convenience, the Partytown CLI provides a `copylib` task. The last argument should be the directory where the Partytown lib files should be copied too. In the example below, the lib files are copying to the directory `public/~partytown`, relative to the current working directory: | ||
|
||
```bash | ||
partytown copylib public/~partytown | ||
``` | ||
|
||
This command can be used before a build script. Below is an example of copying the Partytown lib files before a Nextjs build command, using npm scripts: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"build": "npm run partytown && next build", | ||
"partytown": "partytown copylib public/~partytown" | ||
} | ||
} | ||
``` | ||
|
||
### Copy Task API | ||
|
||
The same code that the `partytown copylib` CLI task uses, is also exposed as an API and can be imported by any NodeJS script. Below is an example of importing the `@builder.io/partytown/utils` API and copying the lib files to the given directory. Both examples of an ESM import or CommonJS require should work. | ||
|
||
```js | ||
import { copyLibFiles } from 'builder.io/partytown/utils'; // ESM | ||
// const { copyLibFiles } = require('builder.io/partytown/utils'); // CommonJS | ||
|
||
async function myBuildTask() { | ||
await copyLibFiles('path/to/public/~partytown'); | ||
} | ||
``` | ||
|
||
### Webpack | ||
|
||
Below is an example of using [Webpack's copy plugin](https://webpack.js.org/plugins/copy-webpack-plugin/) to copy the source `lib` directory found in the [@builder.io/partytown](https://www.npmjs.com/package/@builder.io/partytown) package, to the `public/~partytown/` directory: | ||
|
||
```js | ||
const CopyPlugin = require('copy-webpack-plugin'); | ||
const partytown = require('@builder.io/partytown/utils'); | ||
|
||
module.exports = { | ||
plugins: [ | ||
new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: partytown.libDirPath(), | ||
to: path.join(__dirname, 'public', '~partytown'), | ||
}, | ||
], | ||
}), | ||
], | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
410b52a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: