This article will cover best practices on how to instrument Amplitude on third-party website builders, specifically Wix and Squarespace, as they have been the most common platforms to date.
NOTE: These instructions may become outdated as the third-party platforms under discussion here make changes and upgrades. Amplitude's Support team will provide support for the instructions and processes contained in this article only; they cannot provide recommendations for anything not included here.
Wix has a Tracking Tools & Analytics feature, which you can use to embed Amplitude’s JS SDK snippet and code to your site.
To do so, follow these steps:
- Go to Settings in your site's dashboard.
- Click the Tracking & Analytics tab, under Advanced Settings.
- Click + New Tool and select Custom.
- Set up your custom code:
- Enter your custom code.
- Select the relevant domain. This option will appear only if you have multiple domains.
- Enter a name for your custom code.
- Add Code to Pages: Select which pages to add your code to:
- All Pages: Click the dropdown and select either Load code once, or Load code on each new page.
- Choose specific pages: Begin typing the name of the relevant pages. Then click the checkbox next to the relevant page.
- Place Code in: Select where the code snippet in placed in your site's code.
- Click Apply.
Some customers have told us that Wix allows you to add header scripts, but not to call functions from them. One suggested workaround is putting the necessary script in the Public folder.
Further reading on Wix
Squarespace's Code Injection and Code Block features let you embed Amplitude’s JS SDK snippet and code to your site.
NOTE: These features may be premium features, only available in Business and Commerce plans.
Use Code Injection to add Amplitude’s JS SDK install snippet and other scripts that enhance specific parts of your site, like an order confirmation page.
Next, add the JS SDK install snippet with Code Injection by following these steps:
- Open Code Injection. In the Home menu, navigate to Settings > Advanced > Code Injection.
- Add JS SDK code into the appropriate Code Injection fields for the header, footer, lock page, or order confirmation page.
- Header: Code added here is injected into the <head> tag on every page in your site. This is where the Amplitude JS SDK install snippet will be.
- Learn more about your other three options here.
- After adding your code, click Save.
To add a Code Block, follow these steps:
- Edit a page or post, click an insert point, and select Code from the menu. For help, visit Adding content with blocks.
- Add your code in the text field: see our Using the SDKs documentation for the event and properties calls
- If you're using the Code Block to display code snippets, check Display Source.
- Click Apply to save your changes.