← Back to Blog

10 Easy Steps to Add Campaign Name to Contact in HubSpot and Salesforce using GTM, Persist Campaign, and JS

Topic: Campaign tracking
10 Easy Steps to Add Campaign Name to Contact in HubSpot and Salesforce using GTM, Persist Campaign, and JS

Table of Contents

  1. Introduction
  2. Step 1: Install Google Tag Manager
  3. Step 2: Set Up UTM Parameters
  4. Step 3: Create a Custom HTML Tag in GTM
  5. Step 4: Add Script to Persist Campaign as Cookies
  6. Step 5: Capture UTM Parameters in HubSpot
  7. Step 6: Sync UTM Parameters to Salesforce
  8. Step 7: Update Contact with Campaign Name in HubSpot
  9. Step 8: Update Contact with Campaign Name in Salesforce
  10. Step 9: Track Offline Conversions Back to Google Ads
  11. Step 10: Test and Monitor the Setup

Step 1: Install Google Tag Manager

To implement the campaign name tracking, we'll use Google Tag Manager (GTM). If you haven't already, install GTM on your website.

Step 2: Set Up UTM Parameters

Before we can start tracking campaign names, we need to make sure your campaigns are properly tagged. Use UTM parameters to add campaign information to your URLs.

Step 3: Create a Custom HTML Tag in GTM

Next, create a custom HTML tag in GTM to capture the UTM parameters from the URL and store them as cookies.

Step 4: Add Script to Persist Campaign as Cookies

Add the JavaScript code snippet provided in this blog post to your GTM custom HTML tag. This script will persist the campaign name as cookies.

Step 5: Capture UTM Parameters in HubSpot

In HubSpot, create a form field to capture the campaign name. This will allow you to associate the campaign name with each contact.

Step 6: Sync UTM Parameters to Salesforce

To ensure the campaign name is passed to Salesforce, map the UTM parameters to corresponding fields in Salesforce.

Step 7: Update Contact with Campaign Name in HubSpot

Using the GTM data layer, update the contact properties in HubSpot with the campaign name.

Step 8: Update Contact with Campaign Name in Salesforce

Similarly, use the GTM data layer to update the contact records in Salesforce with the campaign name.

Step 9: Track Offline Conversions Back to Google Ads

If you have offline conversions that are linked to your Google Ads campaigns, you can also pass the campaign name back to Google Ads using offline conversion tracking.

Step 10: Test and Monitor the Setup

Once everything is set up, thoroughly test the tracking and monitor the data in both HubSpot and Salesforce to ensure everything is working correctly.

By following these 10 easy steps, you can seamlessly add the campaign name to your contacts in HubSpot and Salesforce using GTM, Persist Campaign, and a bit of JS. This integration allows you to capture and track campaign data, sync it with your CRM, and even use it for offline conversions back to Google Ads.

If you need assistance with implementing this setup or have any questions, feel free to reach out to Full Stack Marketing. Start leveraging the power of campaign name tracking today!