-
-
Hi,
It would be nice to have a Track Event functionality on some elements of the theme such as the buttons.
Maybe additional fields to fill in in the property of the button. The target is to have the same result as :
<a onclick=”ga(‘send’, ‘event’, ‘Category’, ‘Action’, ‘Label’);” href=”https://www.example.com/file.pdf”>BUTTON< / a > -
We will do our best to make an update for this reason. But for now you can add a new field easy in Element. Go to includes/core/codeless-elements.php. Add this code at line 4390 (make sure that you are in the latest release of Specular 1.2.8)
array ( 'heading' => 'Onclick', 'admin_label' => true, 'param_name' => 'onclick', 'value' => '', 'type' => 'textfield', ),
After that go to vc_templates/button.php
Find this:
‘button_2_link’ => ’#’
replace with
'button_2_link' => '#', 'onclick' => ''
At line 32 add the new tag:
<a onclick="'.$onclick.'" .....=""></a>
Best regards!
-
Hi again.
It seems it doesn’t work with the latest update of Specular/VC…
Please can you update the directives ?
Thank you
-
I found a very easy solution !
Instead of modifying the theme’s core files, and to avoid the problem mentioned above : just replace the Button element with Raw HTML element, in which we add the Google Analytics code.
Example :
<div class=”wpb_content_element button “><span>Téléchargez le guide</span><i class=”moon-arrow-right-5″></i></div>
:)
-
Another try for the code to appear correctly : (replace @@ with <>)
@div class=”wpb_content_element button “@@a onclick=”ga(‘send’, ‘event’, ‘Guide’, ‘Download’, ‘Guide Prolongez la vie des ordis’);” class=”btn-bt align-right default” href=”https://www.insertech.ca/wp-content/documents/techno-responsables/insertech-guide-prolonger-vie-ordinateurs.pdf”@@span@Téléchargez le guide@/span@@i class=”moon-arrow-right-5″@@/i@@/a@@/div@
-
You must be logged in to reply to this topic.