Lead Gen & CRM's tracking code allows you to take full advantage of all of the features in marketing automation.
Without it, you will not be able to personalize your content based on your lead's behavior and interests.
This article will detail how to insert your tracking code to a site that uses a Wordpress theme.
Article Contents
Trial | ✓ | |
Essential | ✓ | |
Advanced | ✓ | |
Ultimate | ✓ |
Administrators | ✓ | |
Company Managers | ||
Marketing Managers | ||
Sales Managers | ||
Salespersons | ||
Jr. Salespersons |
Regarding Child Theme Modification
When adding tracking codes to Wordpress, Lead Gen & CRM strongly recommends that you use a child theme. Using a child theme instead of a parent theme helps to prevent your Wordpress content from breaking when you update.
When using a child theme, make sure the tracking code is only on the child theme for your Wordpress site. There are differences between parent and child themes. If you are using a child theme, the tracking code should not be placed in the parent theme. This is due to the fact that when the header.php for the parent theme is updated, any embedded tracking codes will be overwritten.
Child themes are not required to have a header.php file, so not every child theme may be impacted. All child themes will have a functions.php file, though. You could instead put the following tracking code in to the child theme's functions.php file:
/**
* Load the Lead Gen & CRM site tracking script
* into the <head> of the WordPress site
*/
function load_lead gen & crm_tracking() {
?>
<!--INSERT YOUR LEAD GEN & CRM TRACKING SCRIPT HERE-->
<?php
}
add_action('wp_head',
'load_lead gen & crm_tracking');
Both do not need to occur at the same time, however. You need to only place tracking code in either the header.php of their child theme, or put the tracking code in the functions.php file of the child theme.
Refer to Wordpress' external support documentation for more information on creating child themes.
Adding Tracking Code to a Wordpress Theme
You can add tracking code to Wordpress themes.
To add tracking code, do the following:
- Open a new tab in your web browser.
- Log into Lead Gen & CRM in that browser tab.
- Generate a Lead Gen & CRM tracking code.
- Open another new tab in your web browser.
- Log in to Wordpress in that browser tab.
- Click Editor, located under Appearance in the menu on the left.
- Click the header.php file in the menu on the right.
- Paste your tracking code immediately before the closing
</head>
tag. - Click Update File.
Note: Constant Contact offers Professional Services to assist with custom coding.
When modifying Wordpress themes, consider the following:
- Be careful when changing themes. If you change your Wordpress theme after adding tracking code, then you will need to add that tracking code to your new theme again.
- Sites without themes will need extra attention. If you are not using a theme, then tracking code must be placed on every page of your site before the closing
</body>
tag.
Theme Security Issues
If the editor tab is unavailable in the Appearance menu, there may be theme security settings that are blocking access to the function. Wordpress theme owners tend to do this to prevent access to what they consider as their proprietary data.
If you encounter this issue, consider the following:
- Using a Wordpress plugin to insert the code into the header of the page
- Updating both the header.php and functions.php files through FTP access
- Using a hosting file manager plugin
If none of these are an option, you will need to contact the theme’s owner for more information.
In addition, be aware that, while tracking codes can still be placed into the page's source code, they will need to be placed on every page.
Refer to Wordpress' external support documentation for more information on themes.