There are a number of Dotdigital scripts you can add to your site through your Content Management System (CMS), which allow you to collect and transfer data, and trigger certain actions, across both systems.
Learn more about the available scripts in Integrate Dotdigital with your CMS.
The most straightforward way to add custom JavaScript to your Joomla site is to use a plugin which allows you to add custom script, either to your whole site, or to individual articles.
Add scripts to your entire Joomla site
1. Create your .js file
Log in to your Joomla admin portal.
Go to System > Site Templates and select the template name you want to edit.
Select New File.
Select the js folder from the left side menu, enter a File Name, and expand the File Type drop-down menu and select .js.
Select Create.
In the File Editor, paste in your script or code snippet.
Do not include any<script>
tags, as the plugin adds these automatically.Make note of the file pathway that has been created for your new file.
Select Save & Close.
2. Download and install the plugin
Download the Add Custom JavaScript plugin for Joomla.
In Joomla, go to System, then under Manage, select Extensions.
Select Install Extensions.
On the Upload Package File tab, select Or browse for file.
Locate and select the plugin download file.
Once you see the message to confirm that the plugin has successfully been installed, go to System, and under Manage, select Plugins.
Search for Add custom Javascript, then select the X icon under Status to enable the plugin.
Select the plugin name.
For Javascript File 1 Path, enter the file pathway you noted in Step 1.
You must not include the/
character before the root file location. Your file pathway should look like this:media/templates/site/[template-name]/js/[file-name]
.Expand the Load File 1 in drop-down menu and select Front-end.
In the right hand panel:
Ensure that Status is set to Enabled.
Ensure that Access is set to Public.
Expand the Ordering drop-down menu and select End.
Select Save & Close.
3. Check your script
You can visit your website and use your browser’s dev tools, or inspect the page source, to check that the script has been applied to your site.
For instructions on how to test that Dotdigital’s Web behavior tracking script is working correctly, see the section Check it’s working.
Add scripts to individual Joomla articles
1. Download and install the plugin
Download the Sourcerer plugin for Joomla.
In Joomla, go to System, then under Manage, select Extensions.
Select Install Extensions.
On the Upload Package File tab, select Or browse for file.
Locate and select the plugin download file.
Once you see the message to confirm that the plugin has successfully been installed, go to System, and under Manage, select Plugins.
Search for Sourcerer, and ensure that the following plugins are set to Enabled:
Button - Regular Labs - Sourcerer
System - Regular Labs - Sourcerer
2. Add code to a Joomla article
Go to Content > Articles.
Select the article name that you want to edit.
Place your cursor in the area where you want to place the code snippet, then expand the CMS Content drop-down menu and select Code.
Paste your code snippet into the Code field.
Select Insert.
Select Save.
For further information or assistance on working with Joomla, see the Joomla support documentation or post queries in the Joomla forum for community support.