adobe analytics - how to track the social media icons using DTM (Dynamic tag manager) -
i have below code in web site.
i want track each anchor tag using dtm. know how track single element. since here have bunch of different elements, can how track them using dtm? don't want create separate rule each element. in single rule how can track these elements.
here example of can do.
for element tag or selector put "a.at-share-btn
" (no quotes). target relevant links first. can in next step, "pre-qualifying" improve performance rule not evaluated against every single a
click.
then, under rule conditions, add criteria of type data > custom.
in custom box, add following:
var sharetype = this.getattribute('class').match(/\bat-svc-([a-z_-]+)/i); if (sharetype&&sharetype[1]) { _satellite.setvar('sharetype',sharetype[1]); return true; } return false;
this code looks class (e.g. "at-svc-facebook") , puts last part of (e.g. "facebook") data element named sharetype
.
then, can reference using %sharetype%
in of dtm fields. note: because data element made on-the-fly, not show in auto-complete when type out in field.
alternatively, in custom code boxes (e.g. if needing reference in javascript/3rd party tag box), can use _satellite.getvar('sharetype')
Comments
Post a Comment