html - Setting Up Events in Google Tag Manager with Parent/Child Attributes -
pushing code out on site happens monthly , wanted add in event tags on buttons on site using google tag manager.
because classes & id's in parents , not directly on click attribute having trouble figuring out how target specific button. right every time test in different ways can't seem work. reading article try me: http://www.periscopix.co.uk/blog/new-gtm-trigger-condition-matches-css-selector/
the piece of code i'm trying target users click on 'apply' button.
<div id="universal-actions" class="pull-right"> <ul class="nav nav-pills"> <li class="button-visit"><a href="/visit/">visit</a></li> <li class="button-apply"><a href="/apply/">apply</a></li> <li class="button-login"><a href="/login/">login</a></li>
i tried couple different variations of targeting id & li class, , class , click url, can't seem right. tried css selector of: ul.nav nav-pills > li.button-apply
thanks help! i'm new google tag manager , having trouble these parent attributes.
you close. selector need ul.nav.nav-pills > li.button-apply
. notice period between "nav" , "nav-pills" in lieu of space. that's because ul has two classes, , each needs represented own class selector, hence .nav
, .nav-pills
.
see also: css selector applies elements 2 classes
Comments
Post a Comment