Add Attributes to Identify Html Elements or Specify Event Name

Adding attributes to identify HTML elements for tracking

With the attributes under Simple Click Event and Customized Click Event, you should be able to track most of the HTML elements on your website.  If you still cannot find a HTML attribute that can uniquely and persistently identify your HTML element (or the element group), such as in an A/B testing environment, you need to ask your website developer to add some attributes to the HTML element that can uniquely and persistently identify the HTML element.

You can add the following attributes that fit your website:

  1. Id or name: This is the simplest way and you can use SkyGlue Simple Customization to track events using these two attributes.
  2. Some other HTML elements you may use are, e.g. “title” for any html tag,”alt” for image, “class” if they may share the same CSS style. See the full list of possible attributes here.
  3. Using customized attributes that start with “data-“, e.g. data-promotion-group-id. This is a standard way to specify customized attributes in HTML5 . You can use the customized attributes even if you are not using HTML 5 on your web page. For example:
  • data-promotion-group-id=”shoes”>Latest men’s shoes
  • data-promotion-group-id=”shoes”>Latest women’s shoes

Adding attributes to customize event names for HTML elements for event tracking purpose

If you use SkyGlue to track a group of HTML elements and you want to send different values to Google Analytics based on the specific links the user clicks, you can use SkyGlue macro to specify the event names. See details here.

If your HTML element does not have the attributes you want, you can add additional HTML attributes to describe.

  1. You may use any HTML element, e.g. Id, name, “title” for any html tag,”alt” for image. See the full list of possible attributes here.
  2. Using customized attribute that starts with “data-“, e.g. data-promotion-group-id. This is a standard way to specify customized attributes in HTML5. See HTML 5 spec.  You can use the customized attributes even if you are not using HTML 5 on your web page. For example:
  • data-promotion-link-type=”shoes_men”>Latest men’s shoes
  • data-promotion-link-type=” shoes_women”>Latest women’s shoes

Now you can track the promotion link using the data-promotion-group-id, and specify the event name as ShoePromotion_{#data-promotion-link-type} in your SkyGlue portal. SkyGlue will send events with names like “ShoePromotion_shoes_men”. See more about event name setting here.