- Create custom snippets for your Optimizely projects
- View and manage custom snippets
Custom snippets allow you to decide what projects and pages go into your snippet. Custom snippet permissions are based on the collaborator role. If the custom snippet feature is enabled for your account, all collaborators can view all of your account's snippets and copy snippet codes.
Administrators can create, edit, and archive custom snippets for any project in their accounts.
Project Owners can create custom snippets for their projects. They can also edit and archive custom snippets—as long as they have owner permissions on all of the projects included in the snippet. For example, to edit or archive a custom snippet that includes multiple projects, a user must be a Project Owner for every project in the snippet.
Create a custom snippet
Here's how to create a custom snippet for your projects:
If you want to include more than one project in your custom snippet, confirm that all of the projects you want to include are linked projects.
Navigate to Settings > Implementation and click Create Custom Snippet...
Administrators can also access custom snippets by navigating to Account Settings > Snippets and clicking Create Custom Snippet...
In the Create Custom Snippet dialog, specify the settings you want for the snippet.
See Custom snippet options below for more information about the settings you can choose.
When you create a custom snippet, the project that you're currently in is included in the custom snippet by default.
Custom snippet options
Name: User-friendly name for the custom snippet; appears in the dashboard and elsewhere in the UI
Key: Unique snippet identifier that's included in the snippet URL; must be unique to the account
Description: Optional summary of how the snippet is generated and where it will go
Type: Choose whether the snippet is for a single project or for linked projects
Project: Specific projects the snippet should pull from (for linked projects); default is a single-project snippet for the current project
Pages: Pages to include and exclude from the snippet (default is to include all pages in the project)
Include URL and Exclude URL: URLs to include, exclude, or both (depending on your Pages selections)
Matching criteria: match to URL (snippet will include or exclude the specified URL) or match to substring (snippet will include or exclude any page that matches the specified substring); see Custom snippet matching criteria for details
View and manage custom snippets
Administrators can view and manage all custom snippets for their accounts by navigating to Account Settings > Snippets.
All collaborators can view snippets for the current project by navigating to Settings > Implementation. As long as the project has at least one custom snippet, you'll see a dashboard that lists all basic and custom snippets that are associated with the project.
Administrators and Project Owners can click a custom snippet name to edit the snippet settings. They can also archive custom snippets by clicking the icon. Remember, Project Owners must be owners for all of the projects included in a custom snippet to edit or archive the snippet.
Basic snippets cannot be archived.