Lead Gen & CRM
How can we help you?
Search our help articles, video tutorials, and quickstart guides

You've got this. You've got us. Search our Knowledge Base to quickly find answers to your questions.

Adding Tracking Codes to Wordpress

Article: 000050427
Updated: July 18, 2024

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

 
Users:
Administrators 
Company Managers  
Marketing Managers  
Sales Managers  
Salespersons  
Jr. Salespersons  

Light Bulb IconTip: Are you looking for information about Constant Contact’s Email and Digital Marketing product? This article is for Constant Contact’s Lead Gen & CRM product. Head on over to the Email and Digital Marketing articles by clicking here. Not sure what the difference is? Read this article.

 

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:

  1. Open a new tab in your web browser.
  2. Log into Lead Gen & CRM in that browser tab.
  3. Generate a Lead Gen & CRM tracking code.
  4. Open another new tab in your web browser.
  5. Log in to Wordpress in that browser tab.
  6. Click Editor, located under Appearance in the menu on the left.
  7. Click the header.php file in the menu on the right.
  8. Paste your tracking code immediately before the closing </head> tag.
  9. 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:

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.

 


Did this article answer your question?


Constant Contact Logo

Copyright © 2025 · All Rights Reserved · Constant Contact · Privacy Center