Looking for custom script in Adobe DTM data element

amitj723

29-09-2016

I am trying to capture HTML text value in DTM. There is a article tag which has the detail of the card. Once the User clicks on the card, the name of card (h1) tag will be reported. Below mentioned my code snippet.

<article class="mu-item"> <a href="#"> <div> <h1>This is a test text for tracking</h1> <p>This was the day when the South Stand at Old Trafford, the stadium where he played around half of his 758 matches for United, was officially renamed in his honour before his beloved Reds took on Everton in the Barclays Premier League.<br><br> </p> </div> </a> </article>

I have tried creating event based rule with data element but nothing is working fine. Can anyone please provide the right direction. should i have to create a data element or not. What should i define in my data element. do i have to use DTM custom scripts.

Accepted Solutions (1)

Accepted Solutions (1)

JillsMatthew

30-09-2016

amitj723 wrote...

I am trying to capture HTML text value in DTM. There is a article tag which has the detail of the card. Once the User clicks on the card, the name of card (h1) tag will be reported. Below mentioned my code snippet.

  1. <article class="mu-item">
  2. <a href="#">
  3. <div>
  4. <h1>This is a test text for tracking</h1>
  5. <p>This was the day when the South Stand at Old Trafford, the stadium where he played around half of his 758 matches for United, was officially renamed in his honour before his beloved Reds took on Everton in the Barclays Premier League.<br><br>
  6. </p>
  7. </div>
  8. </a>
  9. </article>

I have tried creating event based rule with data element but nothing is working fine. Can anyone please provide the right direction. should i have to create a data element or not. What should i define in my data element. do i have to use DTM custom scripts.

 

 

In order to get the text from <h1> tags, in your event based rule for <h1> clicks, try using %this.@cleanText% as the value for your variable (See attached screenshot)

eVar1="%this.@cleanText%"