JavaScript Testing

Prev Next

📚 Web Form Attribution Series - Part 3 of 3

Part 1: Web Form Attribution Tracking - Implementation guide  

Part 2: JavaScript Overview - Understanding the JavaScript

Part 3: JavaScript Testing Guide (you are here)  

This Document Will Cover:

Quick Reference for Technical Users

  1. Clear everything: imt.clearCache(); + clear local storage

  2. Set UTMs: ?utm_medium=medium1... then ?utm_medium=medium2...  

  3. Inspect form: Search for "medium1" (First-Click) and "medium2" (Last-Click)

  4. Submit with unique email: YYYYMMDD_HHMM@domain.com

  5. Verify in Salesforce: Lead → Engagement record

Debug in browser console: imt.enableDebug(); (enable) | imt.clearCache(); (clear cache)

For detailed step-by-step instructions, continue below.


Prerequisites

  • Integrous JavaScript must be installed on all pages being tested

  • Hidden form fields must be present on forms (see Web Form Attribution Tracking guide)  

  • Access to Salesforce to verify results

  • Marketing Automation Platform sync enabled

  • Basic familiarity with browser developer tools


Initial Setup and Cache Clearing

Step 1: Complete Browser Reset

  1. Close all tabs for all domains and sub-domains related to the customer anywhere on your computer

  2. Open each domain and sub-domain you plan on testing in separate tabs

Step 2: Clear Cache and Storage for Each Tab

Complete the following steps in each tab you opened:

  1. Right-click anywhere on the page and click 'Inspect Element' to open developer tools

  2. Right-click the 'Refresh' icon in the browser next to the URL bar and select "Empty Cache and Hard Reload"

  3. Go to the Console tab in the developer tools

    1. Type: imt.clearCache();

    2. Hit ENTER

  4. Go to the Application tab in the developer tools

    1. Navigate to Local Storage in the left sidebar

    2. Right-click and select 'Clear' for each entry in the local storage


Testing Multiple Domains/Subdomains

If testing cross-domain tracking:

  • Test each domain/subdomain separately first

  • Then test navigation between them to verify attribution persists

  • For subdomains (e.g., blog.company.com, www.company.com), the JavaScript should automatically share data

Note: For cross-domain tracking to work, Integrous must configure each domain for you in the JavaScript settings.


Core Attribution Testing

Step 3: Primary UTM Test

  1. Set First Attribution:

    1. Copy/paste the following to the end of the URL you'd like to test:

      1. ?utm_medium=medium1&utm_source=source1&utm_campaign=campaign1&utm_content=content1&utm_term=term1

    2. Hit ENTER

  2. Set Second Attribution:

    1. Replace the query string with this new query string:

      1. ?utm_medium=medium2&utm_source=source2&utm_campaign=campaign2&utm_content=content2&utm_term=term2

    2. Hit ENTER

    3. You've now stored two sets of UTMs in your browser's local storage

Step 4: Form Field Verification

  1. Navigate to the form you'd like to test

  2. Right-click anywhere on the page with the form and click "Inspect Element" to open developer tools

  3. Click on the Elements tab in the developer tools if it's not already selected

Visual Verification in Developer Tools

  1. Command+F on Mac or Ctrl+F on Windows and search for "medium1"

    1. Confirm it corresponds to the First-Click (FC) Medium hidden field

    2. Look for field names like: IA_-_PROCESSING_FC_UTM_MED__c

  2. Command+F on Mac or Ctrl+F on Windows and search for "medium2"

    1. Confirm it corresponds to the Last-Click (LC) Medium hidden field  

    2. Look for field names like: IA_-_PROCESSING_LC_UTM_MED__c

  3. Verify these fields contain your test UTM values

Step 5: Form Submission and Tracking

  1. Submit the form, using a new unique email address

    1. Format: YYYYMMDD_HHMM[AM/PM]@[your domain].com

    2. Example: 20240911_1228pm@integrousanalytics.com


Salesforce Verification

Step 6: Salesforce Data Validation

  1. Wait for Processing: Give time for the Marketing Automation Platform to process that information and sync to Salesforce

  2. Find the Lead: Search for the lead with that email address in Salesforce

  3. Check Engagement Record: Click on the Engagement record associated with that lead

  4. Confirm All Fields: Verify all the fields set by the JavaScript captured the info you expect to find:

    1. Five 'First-Click' (FC) UTMs and External ID

    2. Five 'Last-Click' (LC) UTMs and External ID

    3. Entry Page

    4. Conversion Page


Additional Test Scenario - Cross-Domain Navigation

  • Start on one domain with UTMs

  • Navigate to subdomain

  • Submit form on subdomain

  • Verify attribution persists across domains


Advanced Debugging

Enable Debug Mode

Enable Debug Through the Developer Console:

  • Open the Developer Console in your browser (usually accessible via F12 or Ctrl + Shift + I)

  • Run the function: Enter imt.enableDebug(); in the console and press ENTER

  • Refresh the page to apply the changes

  • Repeat this step for each subdomain if needed

  • To disable debug mode, clear the local storage value debug-mode

Complete Cache Clearing

To fully clear the cache for a subdomain, run the following command in the browser's developer console:

imt.clearCache();


Troubleshooting Common Issues

JavaScript Not Loading

  • Check browser console for errors

  • Verify GTM is firing on the page  

  • Confirm JavaScript tag is set to fire on "All Pages"

Hidden Fields Not Populating

  • Verify field names match JavaScript configuration

  • Check if form is in an iframe (requires special setup)

  • Confirm fields are not pre-populated with values

  • Ensure form fields are actually hidden (not just invisible)

Attribution Not Reaching Salesforce

  • Check Marketing Automation Platform field mapping

  • Verify "Processing" fields are being populated

  • Check Salesforce user permissions

  • Confirm MAP sync is enabled and running

  • Ensure field mapping between the MAP and Salesforce is configured correctly

Cross-Domain Issues

  • Verify all domains are configured in JavaScript settings

  • Check that JavaScript is installed on all domains/subdomains


Expected Processing Times

  • JavaScript populates fields: Immediate

  • MAP sync to Salesforce: 5-15 minutes (varies by platform)

  • Engagement record creation: Immediate upon MAP sync completion


Testing Checklist

  • JavaScript loads without console errors

  • Hidden fields populate with correct UTM values  

  • Form submission successful

  • Lead created in Salesforce with unique email

  • Engagement record created and linked to Lead

  • All attribution fields populated correctly

  • First-click attribution shows "medium1, source1, campaign1, content1, term1"

  • Last-click attribution shows "medium2, source2, campaign2, content2, term2"

  • Entry Page and Conversion Page URLs captured

  • Cross-domain tracking works (if applicable)