elementor/elementor

Unique ID associated with button anchor tags

clickharder opened this issue · 0 comments

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

Anchor tags used for buttons do not have a unique ID associated with them. Assigning a unique ID or css class to the button widget associates the ID or class to the parent div instead of the anchor tag.

Ideally, there should be a unique identifier associated with each button anchor tag for identification and use for Google Analytics events.

A unique class or id could be included by adding the widget id to the anchor tag. A solution similar to this:

File: /elementor/includes/widgets/button.php

On line 423 within the render() function

$id_int = $this->get_id_int();
$this->add_render_attribute ( 'button', 'class', 'btn-'.$id_int );

Thanks