Dynamic Code – Google Tag Manager


Important Information:

Please ensure you are fully conversant with Google Tag Manager before applying the Mediahawk Tracking code. 

The Guide is a recommended installation but your installation may differ dependant on the Google Tag Manager setup. 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 only installs Step 1 of the Dynamic code via Google Tag Manager, 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 Mediahawk Dynamic Code using Google Tag Manager.

Login to you Google Tag Manager account - https://tagmanager.google.com

Click Add a new tag

Click Choose a tag type to begin set-up

Select Custom HTML

Copy (CTRL + C) and Paste (CTRL + V) the code from Step 1 of the Dynamic Code from the Dynamic document.

Recommended – Click advanced settings and select Once per page under Tag firing options

(This will mean our code will only trigger once per page load)

Click Choose a trigger to make this tag fire

Select All Pages

It will return you to the Previous Page and should look like this

Enter a name in the top left (currently labelled Untitled Tag) and click Save

Your workspace now looks like this.  Click Submit

Please ensure the code has been updated correctly and any testing performed including Preview. Enter a name for the version and click Publish

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

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

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="mediahawkNumberX 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.