Looking for custom script in Adobe DTM data element | Community
Skip to main content
September 29, 2016
Solved

Looking for custom script in Adobe DTM data element

  • September 29, 2016
  • 2 replies
  • 1755 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JillsMatthew

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%"

 

2 replies

ParitMittal
Level 10
September 30, 2016

Hi Amit ,

 As per our understanding , you are trying to create an event based data element. Please refer the below article for creating the same :-

https://helpx.adobe.com/dtm/kb/Event_Based_Data_Element_or_pass_custom_page_data_to_Data_Element.html

Thanks & Regards

Parit Mittal

JillsMatthewAccepted solution
Level 4
September 30, 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%"