Type: There are 3 resource types supported
Local File - Points to a file store locally on the Miva server
External File - References a path to a JS file hosted externally, typically from a CDN
Inline Script - Outputs an inline Script Tag
File Path: The relative path to the file (local file) or the absolute path to the external file. N/A for inline script tags
Script Tag Attributes: Preview of the script output including custom tag attributes you have added. These can be added or removed by selecting the resource from the batch list and clicking the “Edit Attributes” button.
Global: Whether the script appears on all pages. Default is global. If a script is not global, you have the ability to select which pages you would like it to appear on by selecting the resource from the batch list and clicking on the “Pages” button.
Here you can assign a JS resource to be output on a specific page vs all pages (global)
Local Files - For files that live locally on your Miva Server, when editing, Miva will open the file and allow you to make changes and resave the file on the server to the same location. It's important to note that if you are editing files via the admin and via FTP at the same time, it's possible to overwrite your changes. Its up to you, the developer, to ensure the JS files are not being overwritten by someone else. With local files, there is also no version control or access to Miva variables or template language.
Inline Script - Inline scripts allow for admin editing as well as automatic version history and Miva variables and template language. Because these inline scripts get compiled just like any other page template you can use the power of the Miva Template Language to set variables. The scope of what variables are available will depend on what page the JS Resource is being output on. For example if you wanted to create a JS resource for Adwords Conversion tracking and pass in the order total, as long as you are outputting the script on the INVC page, those variables will be automatically available.
External Files - Editing Is not available for external files
All three JS Resource Types (local, inline, external) support adding custom Attributes to the Script Tag Output. To add your own attributes to the script tag, select the resource and click “Edit Attributes” button. Here you can add custom name/value pairs which will be output in the script tag on the page.
Page Source Output:
These data attributes are: data-script-group and data-script-code
These will always appear after the src attribute and are not editable via the admin (they cannot be removed)
When uploading local files, Miva will always upload all files to a new folder in the following path:
Where /mm5/ is your base directory and 00000001 is your store number. These two values could change based on your specific install of Miva.
This path cannot be changed for files uploaded via the admin, however you can manually FTP files to any path on the server and then manually set that path when adding the file:
One nice feature of the Asset Management Tool is you can specify tracking scripts to only be output on certain pages. This is useful for example when adding Conversion Tracking scripts where you only want the JS output on a specific page.
To do this add the script and set the Global flag to off/false. Then select the script from the list and you’ll see a “Pages” Button
This will bring up a page to select which pages the script gets output on:
By default there is a single resource group called head_tag. This tag is included on every front end page and allows you to add your own custom JS files to be output when it runs.
Lastly, you would need to add the resource group tag to the global footer (or wherever you want it to show up)
This code will include the JS Resource into the page regardless of whether it is marked as Global or assigned to the specific page. However the JS Resource must be active to be included in the page.