AUDIENCE: IT Team, Web Developers
OBJECTIVE: Modify your Beacon Tracking code to properly function on a Joomla website
Joomla is a free and open-source CMS (Content Management System) much like WordPress. It's a very flexible system, and integrating the Act-On Beacon Tracking code can occur in numerous ways. You are free to implement our code using whichever functional way you feel fits best, however this guide illustrates a straightforward method we typically recommend.
- Your Beacon Tracking code (Note: This can be obtained by logging into Act-On as an administrator or marketing user, and then navigating to Settings > Other Settings > Beacon Settings)
- Administrator privileges in your Joomla CMS portal
- Some familiarity with web markup languages is recommended as well before proceeding
Versions of Joomla this guide is compatible with:
- This guide uses screenshots from Joomla version 2.5, but the menu interface in version 3.0 is very similar and code usage is identical.
Part 1: Navigating to the Template Manager
- Open up the Template Manager. This can be accessed either from the Template Manager icon on the main screen, or from the Extensions tab (both shown below).
- Click the name of the template you are currently using to style your website. The script will be applied only to your current website template.
- Choose Edit main page template under Template Master Files.
Part 2: Implementing and Modifying the Tracking Script
Note: Please read this entire section carefully.
In the text area containing your index.php (main page template) code, you will want to paste the Act-On Beacon Tracking code. However, edits are required. Without these edits, the script will not run or your website and will display an error message.
If you are working on a live web page, it is highly recommended that you create a backup of this file before proceeding.
- Type the following above </body> to contain your Beacon Tracking code.
<?php $document = JFactory::getDocument(); $document->addScriptDeclaration(" placeholder -- insert tracking code here "); ?>
- Paste the code into the line above stating "placeholder -- insert tracking code here", removing all placeholder text on that line.
- Lastly, we need to escape the quotation marks of the document write method. Notice how one of the lines of your default Beacon Tracking code will display the following:
'<img src="http://www.actonsoftware.com/acton/bn/3122/visitor.gif?ts='+ new Date().getTime()+ '&ref='+escape(document.referrer) + '">'
'<img src=\"http://www.actonsoftware.com/acton/bn/3122/visitor.gif?ts='+ new Date().getTime()+ '&ref='+escape(document.referrer) + '\">'
- Your modified code to place above </body> should look like this:
<?php $document = JFactory::getDocument(); $document->addScriptDeclaration(" document.write ( '<img src=\"http://www.actonsoftware.com/acton/bn/3122/visitor.gif?ts='+ new Date().getTime()+ '&ref='+escape(document.referrer) + '\">' ); var aoAccountId = '3122'; var aoCookieMode = 'STANDARD'; var aoCookieDomain = 'actonsoftware.com'; var aoServerContext = 'http://www.actonsoftware.com/acton'; "); ?>
Note that your account ID and URL information will be different in your script, so please do not copy and paste the above tracking code examples.
Below is a screen shot of completed code pasted inside a Joomla Template Manager:
With this change made to your template file, the Act-On Beacon Tracking code should now be present on every web page you have (assuming your entire website uses the same template/theme, which is usually the case). You'll only need to repeat this process when changing templates.
If the script does not function or you encounter errors, carefully review your implementation of the above steps, checking for errors such as missing quotation marks. Typos or changes in line-breaks (in some cases) can cause errors. If trouble remains, please contact your Joomla administrator to ensure a specific configuration is not blocking implementation.
Additionally, email@example.com is a resource available to you.