Track button clicks with GTM

Each programme description page in DreamApply has the Share button that allows applicants to share the page link. Assume you want to track how many users click this button and on which programme pages these clicks occur.

To do this, we will integrate DreamApply with Google Tag Manager, set up a tag to capture this data and send it to Google Analytics for reporting.

Sharing the programme description

Before you begin

  • Make sure your Administrator account in DreamApply has the Superuser role.
  • Make sure you have an account and container in Google Tag Manager. For details, see Create an account and container in the Google documentation.
  • Make sure you have an account and a data stream in Google Analytics. For details, see Add a data stream in the Google documentation.

Step 1. Integrate with Google Tag Manager

First, we need to connect DreamApply to Google Tag Manager.

  1. In Google Tag Manager, open your container.

  2. At the top of the page, copy the container ID.

    Getting a Container ID
  3. In DreamApply, in the main menu, under System, select Settings.

  4. In the Analytics settings section, under Google Tag Manager, specify the ID for your container.

  5. At the top of the form, click Save changes.

    Specifying Google Tag Manager settings

Step 2. Enable built-in variables

Next, we need to enable built-in variables in Google Tag Manager. These variables are required to pass information about the click event and page path from the programme description page.

  1. In Google Tag Manager, go to Variables.

  2. Under Built-In Variables, click Configure and enable the following options:

    • Click Text
    • Page Path
Enabling variables

Step 3. Create a click trigger

We need to create a click trigger in Google Tag Manager. The trigger tells Google Tag Manager to fire a tag when a user clicks the Share button on the programme description page.

  1. In Google Tag Manager, go to Triggers.

  2. Click New and create a trigger with the following settings:

    • Trigger name: Share programmes
    • Trigger type: Click - All Elements
    • Trigger fires on: Some Clicks
    • Condition: {{Click Text}} contains Share
  3. In the top right corner, click Save.

Setting a trigger

Step 4. Set up the GA4 configuration tag

We need to connect Google Tag Manager to a GA4 property. This step is required to establish a connection between Google Tag Manager and Google Analytics and send the reporting data to it.

  1. In Google Analytics, locate and copy the Measurement ID for your data stream. For details, see Measurement ID in the Google documentation.

    Getting a Measurement ID
  2. In Google Tag Manager, go to Tags.

  3. Click New and create a tag with the following settings:

    • Tag name: GA4 - Configuration
    • Tag type: Google Analytics > Google Tag (Load the Google tag associated with your Google Analytics stream)
    • Tag ID: The Measurement ID of your data stream in Google Analytics
    • Triggering: Initialization - All Pages
  4. In the top right corner, click Save.

Setting a configuration tag

Step 5. Create a GA4 event tag

Finally, we need to create a GA4 tag that will fire when a user clicks the Share button and send information about the click event to Google Analytics.

  1. In Google Tag Manager, go to Tags.

  2. Click New and create a tag with the following settings:

    • Tag name: Share programmes
    • Tag type: Google Analytics > GA4 Event
    • Measurement ID: The Measurement ID of your data stream in Google Analytics
    • Event name: share_programmes
    • Triggering: Share programmes trigger created in step 3
  3. In the top right corner, click Save.

Setting an event tag

Step 6. Publish the GTM container

Once the tags are set up, we can publish the GTM container. In Google Tag Manager, click Submit, provide a version name and description and click Publish.

Step 7. Test and analyze the Share button clicks

Now, we can test the setup and verify the data is collected correctly.

  1. Open the DreamApply portal in a new browser window using Incognito mode.
  2. Open different programme description pages and click the Share button.
  3. In Google Analytics, open Realtime overview and check the Event count widget.
  4. Look for the event name share_programmes. Click it to drill down into the event parameters.
Viewing event data

Step 8. Create a custom report

To analyze long-term data, we can set up a custom report in Google Analytics. The report will show a list of programme description pages where the Share button was clicked and the number of times the click occurred.

Realtime reports in Google Analytics are available immediately. Standard reports may take up to 24-48 hours to begin displaying data after initial setup. For details, see Data freshness in the Google documentation.

  1. In Google Analytics, go to Explore and select Blank.

  2. In the left pane, under Variables > Dimensions, add:

    • Event name
    • Page title
  3. Under Metrics, add Event count.

  4. In the Settings tab (middle section), add:

    • Rows: Page title
    • Filters: Event name exactly matches shared_programmes
    • Values: Event count
Viewing a table report