How Do I Add Google Analytics Event Tracking to My SoCast Website?

How Do I Add Google Analytics Event Tracking to My SoCast Website?

How Do I Add Google Analytics Event Tracking to My SoCast Website?

Who Is This Article For?

  • Users with the Manage Website Settings permission
  • Applicable to: All Themes

Overview

This article is intended for advanced users who want to add custom event tracking to their SoCast websites. You will need access to the Website Settings panel.

Additional Resources

For more information on using Google Analytics event tracking, visit the official documentation: Google Analytics Event Tracking Guide.

Step-by-Step Guide

  1. Identify the button on your website that you want to track.

  2. Right-click the button and select Inspect Element to open your browser’s developer tools.

  3. In the element’s path (see screenshot below), locate the last element to the right that contains a hash tag (e.g., #listenBtn).

    Inspect Element Example
  4. Add the following code to the Website Custom Footer HTML section. Replace #listenBtn with the element name you found in the previous step:

    <script>
    $("#listenBtn").click(function() {
      ga("send", "event", "player", "listen");
    });
    </script>
        

    This code will send an event to Google Analytics every time the button is clicked.

Once you have added the code and saved your changes, Google Analytics will begin tracking the specified event on your website.