Calculate time between “Became MQL” and “Became SQL” for HubSpot contacts

ROI for completing this tutorial

  • Time: 19 minutes
  • Cost: $0
  • Return on investment: Learn who your best customers are so you can get more of them

This tutorial will teach you how to calculate the number of days it takes for your HubSpot Contacts to move from Marketing Qualified Lead to Sales Qualified Lead.

This will help you understand who your best customers are. You can then adjust your marketing and sales to get more of these ideal customers.

Email the file to yourself

  1. Send yourself the required file for this tutorial

  2. Check your inbox
  3. Download the attachment from the email when it arrives
  4. No need to open the downloaded file, just move it to your Desktop

You should now have a file called calculate-days-between-becoming-mql-and-sql.php on your computer’s Desktop.

Upload the file

  1. Sign in to x10Hosting (or create a free account)
  2. Click the Open cPanel button
  3. Click Switch Theme in the top-right
    • Click Switch to cPanel x3 (or click Keep cPanel x3)
      • You may need to Sign in and click Open cPanel again
  4. Under Files, click File Manager
    • If Directory Selection pops up, select Web Root (public_html/www) then click Go
  5. Click the Upload icon in the top menu
  6. Click Choose File
  7. Find and select the calculate-days-between-becoming-mql-and-sql.php file
  8. Wait until you see “complete” in the bottom-right status
  9. Click the Go Back to “/home/your_username/public_html” link

You should now be looking at your File Manager again. You should see that the calculate-days-between-becoming-mql-and-sql.php file has been added.

Open the file in the Code Editor

  1. Click calculate-days-between-becoming-mql-and-sql.php to highlight it in blue
  2. Click the Code Editor icon
  3. If you see an option to “Select the character encoding to use when you open this file:”
    • Make sure utf-8 is selected
    • Click the Edit button

Add your HubSpot API key to the file

  1. Go to
    • You might need to log in to HubSpot
  2. Click Generate New Key (or View Key)
  3. Click Copy to clipboard
  4. Go back to the cPanel X Code Editor tab in your browser
  5. On line 3, paste your key between the quotation marks
    $hubspotApiKey = "8bd83ea5-3222-4b40-9a9f-67f92c66e930";
  6. Click the Save button in the top-right
  7. Click the Close button in the top-right
  8. Close any other x10Hosting (or cPanel) tabs in your browser

Create a new Contact property

  1. Go back to where you copied your HubSpot API key
  2. In the top menu, on the far left drop-down, select Marketing (not Sales)
  3. In the top menu, click on the Contacts drop-down
  4. Click Contacts Settings
  5. Click the Create new property button
  6. In the Label field, enter Days between becoming MQL and SQL
  7. Make sure Internal name is days_between_becoming_mql_and_sql
  8. Click the Save property button

Create a new workflow

  1. In the top menu, click on the Contacts drop-down
  2. Click Workflows
  3. Click the Create new workflow button
  4. In the Workflow name field, enter Calculate days between becoming MQL and SQL
  5. Under Choose a type of workflow, select Standard
  6. Click the Create a new workflow button

Define the starting conditions of your workflow

  1. To the left of “enroll contacts when they meet these criteria:”, make sure Automatically is selected from the drop-down
  2. Underneath Automatically, click Contact property
  3. In the drop-down underneath Contact property, select Became a Sales Qualified Lead Date
  4. Select the is known option
  5. Click the Done button
  6. Underneath Automatically, you should now see “The contact property Became a Sales Qualified Lead Date is known.”
  7. Click the Change link next to “Contacts will be enrolled the first time they meet the criteria above.”
    • Check the box next to Allow contacts to be reenrolled when the following occur:
    • Make sure They are manually enrolled is checked
    • Check the box next to The contact property Became a Sales Qualified Lead Date is known.
    • Click the Done button
  8. Select the check box next to “Enroll contacts who already meet these criteria.”
  9. Click the Save button

Add an action to your workflow

  1. Place your mouse over the Workflow end box so that Add action or delay is visible above it
  2. Click on Add action or delay
  3. Select Trigger a webhook from the drop-down
  4. Select POST from the next drop-down
  5. In the Enter webhook URL field, enter
  6. Replace with your x10Hosting domain, which you can find by going to and looking next to “Your domain:”
  7. Leave Use authentication? unchecked
  8. Click the Save button

Test your workflow

  1. In the top-right of your workflow screen, click the Test link
    • In the drop-down, search for and select a contact that you know has reached the Sales Qualified Lead stage
    • Click Enroll contact
    • Click the Close button under the Contact enrolled success message
  2. In the top menu, use the Search bar to look up the contact you just enrolled and go to their profile
  3. Click View all properties (or Properties) in the left sidebar
  4. The Days between becoming MQL and SQL property should now be set

Activate your workflow

  1. Go back to your Calculate days between becoming MQL and SQL workflow
  2. At the top, underneath the workflow name, toggle the active status switch to ON


Congratulations on completing this tutorial.

You can now calculate the numbers of days it takes for your Contacts to move from MQL to SQL.

This will help you understand who your best customers are. You can then adjust your marketing and sales to get more of these ideal customers.


Thanks to the following people for giving support and feedback for this tutorial: