Dynamic Code – Website HTML


Important Information:

Please ensure you are fully conversant with applying the code direct to the Website before applying the Mediahawk Tracking code. 

The Guide is a recommended installation but your installation may differ dependant on the Website. If you are not sure please advise your Web agency or developer of the requirement. 

Please check that the code is fully working before publishing. 

This process installs both Step 1 and Step 2 must be applied direct to the HTML code of the website.

Where do I find the Dynamic code?

You will have received an email from Clientservices@mediahawk.co.uk when you joined Mediahawk with the Dynamic code attached, if you do not have this email you can download the Dynamic Code from your Mediahawk account.

Login in to the Mediahawk Platform https://www.reports.mediahawk.co.uk

Select Admin from the right panel 

Click Manage Dynamic then Manage Campaigns

Then Select the Campaign Name you want the Dynamic code for

You will then see 3 options to download the Dynamic Code

Generate HTML – Opens a new window with the Dynamic code

Email me HTML – Opens a new window where you can Email the HTML code

Download HTML – Downloads the HTML code as a PDF



Applying STEP 1 of the Dynamic Code direct to The Website.

Step 1 Installs the necessary script file and dynamically changes the telephone numbers

Simply Copy (Ctrl + C) and Paste (Ctrl + V) the code supplied anywhere within the Website Code

The Below code is an EXAMPLE of the code – do not use.

<script type="text/javascript">

 var _mhct = _mhct || [];


 !function(){var c=document.createElement("script");


 var i=document.getElementsByTagName("script")[0];



Applying STEP 2 of the Dynamic Code direct to the Website HTML code.

Step 2 Generates the class names you need to use for each pool and changes the number in the <span>

In order for your existing number to change you must apply Step 2 of the Dynamic code to all numbers you would like to change. 

An EXAMPLE of the code is below for information. The “mediahawkNumber1” is unique per installation

Your Telephone Number is the existing one you would like to change 

Apply this code for the pool 'A Marketing Company'

If you are applying to a Desktop site use this code

<span class="mediahawkNumber1">Your Telephone Number</span>

If you are applying the code to a Mobile enabled site (or not sure, use this one)

<span class="mediahawkNumber1 mhMobile">Your Telephone Number</span>

Coding Notes.

  • Don't apply any formatting within the element that is being changed. Apply formatting to an outer <div> or <span> for example instead.
  • The elements you apply the generated class names to can be either a <div> or a <span>
  • Applying mhMobile allows the telephone number to be clickable.