Reports

How do I install the HubSpot tracking code on a Drupal site?

Last updated: August 18, 2017

Available For:

Marketing: Free, Starter, Basic, Pro, Enterprise
Sales: Free, Professional

You can install the HubSpot tracking code on your Drupal-hosted pages using a Drupal block. To do so:

  • Copy your HubSpot tracking code by following the instructions here.
  • Once you have copied your HubSpot tracking code, log into your Drupal admin dashboard.
  • Click Structure in the main navigation menu.
  • Select Blocks.
    drupal settings
    drupal settings
  • Click + Add Block.
    add drupal block
    add drupal block
  • Complete the following settings for your new block:
    • Block title: Provide a title for your block, ex. HubSpot Tracking Code.
    • Block description: Provide a description of the block, ex: Track website analytics with HubSpot's tracking code. 
    • Block body: Paste the HubSpot tracking code copied above.
    • Text format: Choose Full HTML.  Please note that in some versions of Drupal, you may need to click Plain Text Editor beneath the Block Body field to ensure that your text is entered as HTML instead of rich text. 
    • Region settings: Choose 'Footer' for your default theme.
    • Visibility settings: If you do not want the HubSpot tracking code to track analytics for certain pages, add them in this section. Otherwise, skip this section.
    drupal block settings
    drupal block settings
  • Click Save block.

Was this article helpful?