Tracking custom events with Google Tag Manager

You can use Google Tag Manager to track custom events you set up in your Smartlook account.

To track Smartlook custom events with Google Tag Manager (GTM), you must:

Tracking custom events with Google Tag Manager

In the following example, we are creating a tag in GTM for a custom event set up for the right arrow button on the testimonial page.

To track custom events with Google Tag Manager:

  1. In GTM, Add a new tag.
Add new tag
  1. Choose Custom HTML tag.
  2. Define the tag as needed. Be sure the HTML contains the Smartlook custom events script.
    <script>
      smartlook('track', 'HP_Testimonial_Arrow_Right_Click');
    </script>
    
  3. Click Triggering to define a trigger.
  4. Click the + to add a trigger.
  5. Under Click, select All Elements.
  1. In Trigger Configuration, choose Some clicks.
  2. Select Page URL, Contains, and the page URL where you have the custom event.
  1. Click Save to save the new tag.
  2. Click Preview to go into GTM Preview Mode.
  1. While in Preview Mode, go to your website in another tab. You should see the debug tab.
  2. The Summary panel lists all actions that GTM listens for on your website. If the tag is set up correctly, Click appears in the Summary panel. If you click the event, you can see the tag that was fired.
  1. Click the Data Layer tab to get element data for the trigger.
  1. Go back to the workspace in GTM and click the Variables tab.
  2. Click Configure.
  1. In the Configure Built-In Variables panel, check the Click Classes checkbox.
  2. Click the Triggers tab.
  3. Open the trigger for the custom event for editing.
  4. Select Click Classes, Contains, and enter the element class customer-review__action--next that we found earlier in Preview Mode.
  1. Click Save.
  2. Refresh your workspace. You can now open your project in Preview Mode again to check if the custom event is set up correctly.