Hover Listener Recipe for GTM | LunaMetrics

Description

Pushes events to the data layer about hover interactions that occur over the given CSS selectors in the page.

(This recipe is for a listener only. It has no visible effect on your site and does not send data to Google Analytics or other tools unless you create additional triggers and tags to do so.)

Instructions

1. Download Container File

Download the container JSON file.

(You may need to right-click on the link and choose “Save Link As” or “Save Target As” to save the JSON file to your computer.)

2. Import JSON File into GTM

Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Check out this blog post for more details about importing a container file.

3. Customize Items to Track

Edit the variable “Constant – Hover Listener CSS Selectors” with a list of CSS selectors, separated by commas, on which you want to listen for hover activity.

4. Create Your Own Tags, Triggers, and Variables.

This particular recipe won’t actually create any tags for you. Create the appropriate Variables to pull out information from the data layer push. You’ll need to create your own trigger using the Custom Event = hover, and then attach that to any tags that you would like to fire.

4. Preview & Publish

Use the Preview options to test this container on your own site. Try testing each of the events to make sure they’re working properly. If everything looks good, go ahead and publish!

  • Google Tag Manager Services

    As an early adopter of Google Tag Manager, we’ve grown up with the product and now recommend it to all of our clients, in both Google Analytics and Search. Our services include Google Tag Manager implementation, integration, and training for your team.

  • Google Tag Manager Trainings

    Learn the ins and outs of Google Tag Manager in this full-day, hands-on workshop geared towards both Web Marketers and Website Professionals. Offered around the country, you'll complete a full implementation in our custom sandbox environment.

  • Google Tag Manager Book for Developers

    Looking for a more complete collection? Check out our recently published book, "Practical Google Analytics and Google Tag Manager for Developers" covering the essentials for implementing Google Analytics through Google Tag Manager.

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.