Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #270880

    I use a text block element with text and an external link like so:
    <a href="http://www.example.com/test.html">Site Name</a>.
    I then switch to “Text” mode and add the google event tracking like so:
    <a href="http://www.example.com/test.html" onclick=ga('send', 'event', 'News', 'Click', 'Test');>Site Name</a>.
    Save and this works, verified in google analytics but the entire “onclick” disappears if you reload the page or switch to “Visual” mode. Any suggestions? How would this work with a button element? Thanks
    Michael

    • This topic was modified 10 years, 6 months ago by HHBeachboy.
    #270881

    Hey!

    It is recommended to use a Code Block for this cases, that will prevent custom code from being stripped by WordPress.

    Cheers!
    Josue

    #270892
    This reply has been marked as private.
    #270900

    I’m referring to this Code Block:

    Cheers!
    Josue

    #270905

    Josue,
    Thanks, that worked!

    #270912

    You are welcome, glad we could help :)

    Regards,
    
Josue

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.