Question on where to add tracking code
-
Hello, I work for a little hotel and we used the Graphene theme to help build our web site. We recently partnered with a company to help rive business to our hotel and they have a tracking system to track calls and what not.
They asked us to install the following code info shown below. I am NOT a coder (which is why I love this theme) but I’m not sure where to install steps 2 & 3. When I go to the “editor” I see a long list of areas of code but I’m not sure in this theme where I should be placing anything. For step 1 –our phone mumber is in a text area widget box that carrys onto every page. Any help would be much appreciated
Btw, the website is http://www.fairwaysuitespeak.com
1. Where ever your regular phone number would normally display on your site, you must enclose that number inside the following tag, replacing the ### symbols with your normal phone number, NOT the dynamic number.
<span class="phone">###</span>
It is ok for you to add any type of style to this class in your style sheet, we will only be changing the number inside the tags.
2. Next, at the bottom of your HTML, copy and paste the following code below,
and place it inside the close </body> tag within each page of your site.
<script type="text/javascript">
var hostType = (("https:" == document.location.protocol) ? "https://app." : "http://app.");
document.write(unescape("%3Cscript src='" + hostType + "phonalytics.com/track/phonalytics.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try
{
var _pat = new Phonalytics();
_pat.phoneTracking('phone');
_pat.trackPageview();
}
catch(e){}
</script>3. Copy and paste the following code and place it at the top of the page, just inside the head tag.
To work correctly, this should be placed before any other JavaScript or CSS includes.
<script type="text/javascript">
(function() {
if(location.host.indexOf('rztrkr')===-1){
var rz = document.createElement('script'); rz.type = 'text/javascript'; rz.async = true;
rz.src = ('https:' == document.location.protocol ? 'https://www' : 'http://www') + '.rztrkr.com/track/return-tracking/';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(rz, s);
}})();
</script>Admin
You would need a child theme for this. See this page for guide on how to create a child theme:
When you’ve done that, create a
functions.php
file inside your child theme. Then, add this code into that file:<?php
function fsp_phone_tracker(){
?>
<!-- Place the tracking codes to be put near the closing </body> tag here -->
<?php
}
add_action( 'wp_footer', 'fsp_phone_tracker' );
function fsp_rztrkr(){
?>
<!-- Place the tracking codes to be put inside the <head> tag here -->
<?php
}
add_action( 'wp_head', 'fsp_rztrkr', 5 );
?>And that should do it.
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.