问题
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.
回答1:
You can do that creating a new "data element" and using the css selector type, the, put the CSS Selector Chain
in this case I will use the following css selector for example.
.mu-item div h1
Now select "text" in the "get the value of" option, and save changes.
It should work.
来源:https://stackoverflow.com/questions/39777917/looking-for-custom-script-in-adobe-dtm-data-element