Adding Custom Javascript CSS and Head Content
Quite often you will need to add some custom CSS[^css], Javascript or add a<head>
[^head_tag] content tag such as the Google Tag Manager into your online store. StoreConnect provides 3 different ways to insert data into your site on a per store basis in the Content Management (CMS) section of the Store record.
Javascript & Script Blocks
Uploading your JS and any script block can be done using the Script Block object. This will allow you to have scripts well organised and maintainable. Any script block will be inserted into the <head>...</head>
tag of your store.
Instructions
-
Click on the app launcher
-
Search for Script Blocks and open that tab
-
On the right hand, click on New
-
Give it a useful name and assign it to your store
- Define the configuration for your Script Block
- Store: Select the store you want to assign it to
- Active: Activate or deactivate this script block
- Global: Does this script apply to the entire site and so should load automatically when rendering each page?
- Position: If you have multiple style blocks, you can set the order they load
- Define the style content: You must use one of these options:
- Script URL: Use an external link to bring in your Javascript
- Content: Define your Javascript here
You can also add things like Facebook pixel code, or domain name validation meta tags, etc. as long as they are not wrapped with <script>
tag as all content in Script Blocks will automatically be wrapped with this HTML tag.
Related help documents
CSS and Custom Styles
This section is now available at:
Body Content Block
The Body Content field is a link to a CMS Content Block that contains anything you wish to insert at the end of the <body>...</body>
of your store.
Common uses for the Body Content block are Live Chat scripts, or other custom javascript that needs to be loaded after the store page has been loaded.
Instructions:
-
Create a content block and use the “No added styling” template
-
Provide a name such as “Body Content” or a name of your choice
-
Use the content field of this new content block to insert or paste any block of code, script, tag, etc. you need to insert into the body section of your site
-
Click Save
-
Now, go to your store’s Store record and tell it to insert your content into the sites body
- Under the CMS section click on the body content field
- Search for your head content block
- Click Save
Related help documents
Back to Documentation