Dynamic Call Tracking with Your Static Phone Number (DIY and DFY)

Dan Burykin
4 min readJan 8, 2020

What is Dynamic Call Tracking?

The main marketing purpose of dynamic call tracking is measuring the efficiency of different marketing channels to generate calls from potential clients: PPC (Google Ads, Facebook Ads etc), organic / SEO, Social Media Marketing, and so on. This sounds like a fantastic opportunity for performance based marketing, as long as digital sources can be adjusted and optimized. While there is a price to pay, dynamic call tracking doesn’t cost a lot. For instance, there is a free Google Forwarding Numbers tool (but doesn’t include all of the call tracking features like calls recording).

The main concern is the ‘random’ phone numbers any dynamic call tracking has to put instead of an actual business phone number for forwarding. Thus, a potential client visits certain business website and see some other phone numbers instead of the actual ones. Those numbers change dynamically without transparent logic, and they also sometimes cause errors, which can be reduced with the manual calls qualification. What’s more, businesses have to either buy/rent all those additional phone numbers, or don’t even own them. However, each phone number is a permanent channel for the first and next communications with a potential and existing clients. If the business doesn’t own its office phone numbers or there are too many of them, dynamic call tracking not 100% commercially secure.

What Kind of Free Dynamic Call Tracking You Might Need

  1. You’ve read the chapter above, you don’t want your business to be dependent on ‘random’ phone numbers, that you don’t actually own as a permanent lead generation sources. Instead, you want to only use your existing phone number(s). You don’t currently need calls to be recorded (or you might use another tool for recording), but your sales/office manager can manually match inbound calls from the website to optimize traffic costs. First, try my tool: www.freecalltracking.com
  2. You've read the chapter above, you are OK with your business having additional virtual phone numbers, you need all the call tracking features like calls recording, but you want to own (rent) the exact list of extra virtual numbers and to pay for it only. Try our freemium call tracking partner: Zadarma solution

DIY Free Call Tracking

The following plan requires advanced Google Sheet & Google Tag Manager user skills. Please, check this article for more detailed code explanations.

  1. Copy this spreadsheet to your Google Account with admin access to the Google Analytics account, which tracks your website visitors.
  2. Go to the script editor from the ‘Tools’ menu and create a new project. Copy the code below, change the constants, save and publish it as a web app:
    // Your GSheet ID, from its url
    var SHEET_KEY = “1iv-uqnN01TymvDPX4pgZHph5jbsVmFAD4raecAE8nYg”;
    // GSheet tab name
    var SHEET_NAME = “website visitors”;
    function doGet(e){
    var lock = LockService.getPublicLock();

    try {
    var doc = SpreadsheetApp.openById(SHEET_KEY);
    var sheet = doc.getSheetByName(SHEET_NAME);
    var data = [];
    var a = new Date(parseInt(e.parameter[‘time’]));
    var date = a.getFullYear() + ‘.’ + a.getMonth() + ‘.’ + a.getDate() + ‘.’ + a.getHours() + ‘:’ + a.getMinutes() + ‘:’ + a.getSeconds();
    data = [e.parameter[‘time’],
    new Date (),
    ‘https://pro-training.com.ua’ + e.parameter[‘path’]];

    sheet.getRange(sheet.getLastRow() + 1, 1, 1, data.length).setValues([data]);
    return ContentService
    } catch(e){
    return ContentService
    .createTextOutput(JSON.stringify({“result”:”error”, “error”: e}))
    } finally {
    // The property ID of your website Google Analytics
    var idGA = “UA-XXXXXXXXX-1”;
    function myOnEdit(e){

    if(e.range.getColumn() == 8 && e.value == “Yes”) {

    var sheet = SpreadsheetApp.getActiveSheet();
    var range = sheet.getRange(1, 1, 1, 8);
    var data = sheet.getRange(e.range.getRow(), 1, 1, e.range.getColumn()).getValues();
    var row = data[0];
    var url = “http://www.google-analytics.com/collect?v=1&tid=” + idGA + “&cid=” + row[3] + “&t=event&ec=call&ea=call&z=” + row[0]+”&ni=1";

    try {
    var res = UrlFetchApp.fetch(url);
    e.range.setNote(‘Event sent ‘ + new Date() + “ url: “ + url);
    } catch © {
    e.range.setNote(c + ‘ res: ‘ + res);
    // This function erases data every midnight to start again
    function Reset() {
    var SHEET_KEY = “1iv-uqnN01TymvDPX4pgZHph5jbsVmFAD4raecAE8nYg”;
    var SHEET_NAME = “website visitors”;
    var doc = SpreadsheetApp.openById(SHEET_KEY);
    var sheet = doc.getSheetByName(SHEET_NAME);
    var range = sheet.getRange(“A2:H500”);
  3. Create a time-based trigger to run the reset function every midnight (or another time/frequency for reseting your ‘Calls Qualification’ tab)
  4. Login to your website’s Google Tag Manager to import the following container: GTM-TH4WD7F_Free_Call_Tracking.json
  5. Change the ‘https://script.google.com/macros/s/XXxxxxxXXxXXXXXXxX_XXxXXxxxXxXxXXXXXxxXXXXxxXxXxXxxXXXx/' part of the string in the ‘Caller On Site’ tag to your web app URL from step 2.
  6. Publish the container and visit your website to check if it is reflected with a new row in the ‘Calls Qualification’ tab
  7. If everything is OK, the person who answers calls to your office can now take one look at the ‘website visitors’ tab of your Free Call Tracking GSheet and easily indentify if the caller is from your website by seeing where the current visitor came from and what is he/she viewing now. In order to double-check, ask to follow another relevant information page and see the same visitor ID activity in real time. Press ‘Call/Call’ in the right column of the calling visitor’s row to match all the current and previous visit’s marketing data with the ‘call from website’ event in Google Analytics.
  8. Should you have any difficulties with the Free Call Tracking setup and/or PPC traffic optimization please let me know on LinkedIn, Email or Live chat at Free Call Tracking.

I’m Dan Burykin, the Free Call Tracking creator and a top-rated marketer. Together we are Top-Rated Team — an international group of independent Google Ads and MarTech pro. Each of us has been setting up and optimizing paid traffic for eCommerce, B2B and B2C lead generation in the United States, Canada, UK, Germany and Ukraine for over 10 years.