Where should I write custom Javascript or CSS files for my COS pages?

Last updated: September 22, 2016

Available For:

Product: HubSpot Marketing
Subscription: Basic, Professional, & Enterprise

To write a custom Javascript or CSS file in HubSpot, follow the instructions below:

  • Navigate to Content > Design Manager.
  • Click New template > choose the Code Editor option > click Create.
User-added image
  • Give the new file a name that includes the appropriate extension file type (.js for scripts / .css for css files/ .html for standard html files), select a location, and click Save.
User-added image
  • When you are finished with your coding, click Actions > Get public URL to generate a HubL include that will be used to reference the file from your pages.
  • From the Public URL window, click Copy > click OK.
User-added image
  • To include your file on all HubSpot hosted pages, navigate to Content > Content Settings > Site Footer HTML > paste the generated token as the value for the script tag’s source, as seen below:
<!-- start Main.js Do Not Remove -->
<script src='insert your generated token here'></script>
<!---End Main.js-->
  • Scroll down and click Save changes to finish.