Targeting options
Global scripts
Scripts set to All Pages load on every page of your site. Use this for:- Analytics and tracking
- Global navigation behavior
- Site-wide styles
Page-specific scripts
Select specific pages where a script should load. You can target pages by: Exact path:Component detection
Load scripts only when specific elements exist on the page. This is powerful for:- Loading a slider script only on pages with sliders
- Running form validation only when forms are present
- Applying animations to specific components
- CSS Selector
- Data Attribute
Enter a CSS selector. The script loads if any matching element exists.
How targeting works
When a page loads, the GoodCraft Script loader:- Checks the current URL against page rules
- Queries the DOM for component detection selectors
- Loads scripts that match either condition
- Skips scripts that don’t match
Priority and load order
When multiple scripts match a page, they load in priority order:| Priority | Load Order |
|---|---|
| 1 (highest) | Loads first |
| 2 | Loads second |
| … | … |
| 10 (lowest) | Loads last |
Examples
Load slider only where needed
Selector:.w-slider
Effect: Script loads only on pages with Webflow sliders
Blog-specific scripts
Pages:/blog/*
Effect: Script loads on all blog posts but not on other pages
Form validation
Selector:form[data-validate]
Effect: Script loads only on pages where forms have the data-validate attribute
Debugging targeting
Open browser DevTools and check the console. The loader logs which scripts were loaded and why:Debug logging is only enabled in development mode or when you add
?gcscript_debug=true to the URL.