Expand my Community achievements bar.

Re: Custom JavaScript (Button Tracking + Event) in DTM

Avatar

Level 2

Branched from -

ParitMittal

I followed up the above code and i received an error message.

I need to track a button on my hompage which has a class.

Could you please advise how to track the button. I want to use event based rule.

I set up an event as "event3" in the report suite. i need to track this event.

could you please show me how to setup in adobe tag manager as well.

4 Replies

Avatar

Level 10

I've branched your question into it's own since the thread you commented on is fairly old and having your own question will help to receive solutions.

With all that said, can you share the URL of the page with the button you're trying to track?

Avatar

Level 2

Hi Jantzen,


For some security reasons, i will not be able to publish the name of the website in this blog.

Would you be able to assist me in this instance without knowing the code.

I can provide the code that you are looking for to better understand how it is on the webpage.

<a title="Sample"

   href="https://forums.adobe.com/apple" type="button"

  class="button black-background white-text green-bold-font-family apple-button">

                Sample

            </a>

When the user clicks the "Sample" button on the first page it will then take the user to the page "/apple" . In this instance they have given the type as button but actually used a "href". In the past i have worked only with the javascript function for the button to click using "onclick" i am little confused in this instance how to use an event tag to fire when the button is been clicked.

Could you please assist.

Thanks

Giri

Avatar

Level 10

You should be able to create a event based rule that utilizes the click event and limits it's scope to that class. After you've gotten the rule firing correctly, you can set whatever variable and events you'd like.

Here is an article from one of our evangelists that shows how to do something similar to what you're trying - Getting Started with DTM: CSS Selectors | Adobe Blog

Avatar

Level 1

Hi,

I'm pretty much used to GA and GTM and I'm completely new to Adobe Launch. I'm looking to track buttons on my e-commerce website. Could you please suggest what Rules, Events, Data Elements & Variables I should be using?