LogoLogo
Help CenterStatusContact
  • Chartbeat Documentation
  • Implement Tracking
    • Standard Websites
      • Adding chartbeat.js to Your Site
      • Customize Tracking Settings
      • Tracking Virtual Page Change
      • User Subscriber Status
      • Alternative Site Integrations
      • Integration QA Steps: Website
      • Additional Page Metadata
    • Google AMP
      • Chartbeat Code for AMP
      • AMP Configuration Variables
      • Alternative AMP Integration
      • Integration QA Steps: AMP
    • Mobile App SDKs
      • Intro to Mobile App Tracking
      • Android SDK
      • iOS SDK
      • Integration QA Steps: Mobile Apps
  • Feature Integrations
    • Headline and Image Testing
      • Adding chartbeat_mab.js to Your Site
      • Image Compatibility
      • Flicker & Flicker Control
      • mab.js Specifications
      • Integration QA Steps: Headline and Image Testing
    • Video Engagement
      • Adding chartbeat_video.js to Your Site
      • Supported OVP Integrations
      • Custom Player Integration SDK
      • Configure Video Tracking Settings
      • Integration QA: Video Tracking
    • Conversion
      • Adding subscriptions.js to Your Site
      • Conversion Events
      • Integration QA Steps: Conversion
      • Supported Conversion Flows
  • API Docs
    • Real-Time API
      • Getting Started with our Real-Time API
      • Traffic Data
      • Video Engagement Data
    • Historical API
      • Getting Started with our Historical API
      • One-time Queries
      • Recurring Queries
      • Metrics, Dimensions, and Filters
    • Headline Testing API
      • Getting Started with our Headline Testing API
      • Raw Data
      • Summary Report
      • Variant Report
    • Conversion API
      • Getting Started with our Conversion API
      • Top Articles
    • Data Lab API
      • Getting Started with Data Lab API
  • Help Center
  • Contact Support
  • Datastream Docs
  • Back to Chartbeat.com
Powered by GitBook
On this page
  • Tracking users' subscriber status
  • Next steps

Was this helpful?

  1. Implement Tracking
  2. Standard Websites

User Subscriber Status

This article details the steps to implement your site's user subscriber status data into Chartbeat by adding a few lines to our standard tracking tag.

Tracking users' subscriber status

If you allow users to login to your site, or provide subscriber-only content, add the below configuration to your Chartbeat tag to enable traffic data segmentation by user-type in our tools. First, you'll need to declare a global _cbq variable with the following code:

var _cbq = window._cbq = (window._cbq || []);

Then, based on what type of user is currently browsing your site, push the following array elements that constitute a key-value pair to the _cbq array:

_cbq.push(['_acct', 'user_type']);

Always push _acct as the first element in the array, with that representing the key of a key-value pair. The second element in the array represents the value of the key-value pair. For the user_type value, please use one of the three standardized values below:

Subscriber Status

user_type Value

Guest

anon

Registered

lgdin

Subscriber

paid

Generally, it's best practice to declare _cbq and perform your _cbq.push() right after your _sf_async_config setup. For example, if you wanted to push a user type of paid, your implementation might look like this (see lines 11 & 12):

<script type='text/javascript'>
    (function() {
        var _sf_async_config = window._sf_async_config = (window._sf_async_config || {});
        /** CONFIGURATION START **/
        _sf_async_config.uid = #####; //CHANGE THIS
        _sf_async_config.domain = 'domain.com'; //CHANGE THIS
        _sf_async_config.useCanonical = true;
        _sf_async_config.useCanonicalDomain = true;
        _sf_async_config.sections = ''; //CHANGE THIS TO YOUR SECTION NAME(s)
        _sf_async_config.authors = ''; //CHANGE THIS TO YOUR AUTHOR NAME(s)
        var _cbq = window._cbq = (window._cbq || []);
        _cbq.push(['_acct', 'paid']);
        /** CONFIGURATION END **/
        function loadChartbeat() {
            var e = document.createElement('script');
            var n = document.getElementsByTagName('script')[0];
            e.type = 'text/javascript';
            e.async = true;
            e.src = '//static.chartbeat.com/js/chartbeat.js';
            n.parentNode.insertBefore(e, n);
        }
        loadChartbeat();
     })();
</script>

It's up to your team to create the custom logic to automatically pass in one of our three user-type values each time our tag is loaded, based on the current user's status in your site's user tracking mechanism.

Next steps

You've learned about our JavaScript tag and tracking script, how to customize your pageview tracking settings with our configuration variables, tracking virtual pageviews, and user subscriber status. Now review our options for alternative integrations of our website tracking code in the next page of this guide to see if any of these options apply to your setup.

PreviousTracking Virtual Page ChangeNextAlternative Site Integrations

Last updated 4 years ago

Was this helpful?

Tip: If your user subscriber status data only becomes available later in the page load, you can load the Chartbeat tag lower in the page HTML instead of placing our tag in the page's header. However, if your site will utilize our Headline Testing integration where some of our code is required to load before the closing <head> tag, we suggest using our detailed in the next page of this guide.

two snippet solution