Implementing and Verifying the True Anthem JavaScript Analytics Tag

The True Anthem JavaScript tag is a lightweight, asynchronous snippet designed to track website activity and social referrers without impacting page load performance. The tag retrieves metadata from your content and sends a page view beacon request to True Anthem’s servers.

 


Placement

The True Anthem JavaScript tag should be placed at the bottom of the page, before the </body> tag, whenever possible. It can also be placed in the <head> or <body> section of your website.

Tag For Implementation

<script src="//static.trueanthem.com/scripts/ta.js"></script>

Tag Management System Support

The tag can be implemented using popular tag management solutions such as:

  • Google Tag Manager
  • Tealium
  • Adobe Dynamic Tag Manager (DTM)

Single Page Applications (SPA)

For SPAs, ensure the page metadata updates properly during navigation and that the script interacts with the History API (e.g., window.history.pushState).

Data Collection

The True Anthem tag collects:

  • Traffic source/referrer information
  • Public metadata from pages (e.g., og:description, og:url)
  • Non-PII (Personally Identifiable Information) data

 


Tag Loading Process

  1. Loading ta.js Script:
    • The script is loaded asynchronously from the True Anthem CDN.
    • Cached by browsers for faster subsequent loading.
  2. Sending a Page View Beacon:
    • The browser calls TRUE_ANTHEM.configure() asynchronously to send a request to b.trueanthem.com/beacon.
    • Successful page view tracking returns an HTTP 200 response.
    • HTTP 403 responses indicate the site host was not registered with True Anthem.

 


Integration with jQuery

If your website uses jQuery, you can load and initialize the script as follows:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
  jQuery(document).ready(function ($) {
    $.ajaxSetup({cache: true});
    $.getScript('//static.trueanthem.com/scripts/ta.js', function () {
      $.ajaxSetup({cache: false});
      window.TRUE_ANTHEM.configure('CAMPAIGN_ID_CODE');
    });
  });
</script>

Replace CAMPAIGN_ID_CODE with the appropriate implementation ID code.

 


Implementation in Adobe DTM

Option 1: Sequential HTML

<script src="//static.trueanthem.com/scripts/ta.js"></script>

Option 2: Non-Sequential JavaScript

(function(d) {
  var e = d.createElement('script');
  e.src = '//static.trueanthem.com/scripts/ta.js';
  e.async = true;
  window.top.document.head.appendChild(e);
}(document));

 


Verifying Tag Implementation

Checking Tag Load in Browser Developer Tools

  1. Open Developer Tools (Inspect Element > Network Tab).
  2. Filter by trueanthem.com.
  3. Reload the page and verify:
    • ta.js is loaded (if implemented directly).
    • beacon request is sent.
    • Beacon status is 200 (success) or 204 for AMP pages.

Checking Tag Load in Google AMP Pages

  1. Load the test page in your browser and open Developer Tools.
  2. Navigate to the Network tab.
  3. In the Filter caption box, type trueanthem.com to filter all page elements from the True Anthem domain.
  4. Reload the page and verify that the following element is loading:
    • beacon request is sent and returning Status Code 204 (successful load).
  5. Click the pageview?clientID=... element and locate the Query String Parameters panel.
  6. Verify that the parameters are loading the correct data for the test page.

 


Diagnosing Issues

If beacon is missing or not working:

  1. Open Developer Tools > Console.
  2. Run the command:
    TRUE_ANTHEM.diagnostics()
  3. Common issues:
    • Undefined Post Type: Ensure og:type metadata tag is correctly set.
    • Missing Canonical or og:url: Verify these metadata tags are present.

 


Whitelisting User Agent for QA

To ensure proper tag functionality in a QA environment, whitelist the following user agent:

Mozilla/5.0 (compatible; trueAnthem/1.0; +http://www.trueanthem.com)

 


Additional Resources

  •  
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Articles in this section