Skip to main content
Participant
October 6, 2016
Question

How do you implement an 'on click' function on menu item?

  • October 6, 2016
  • 2 replies
  • 1233 views

We are testing a third-party backend analytics program. Our site is a single page, so the results of the demo analytics don't show if anyone is scrolling our site. It appears as though someone clicks on our site then just leaves after a minute or so (no engagement). The third-party company has provided HTML code that we've added to the site. But, they are also asking us to set up an 'on click' function to each of our manual menu items.

Here is the sample they provided: An example for your site would be: onClick="track_load('http://sandbox-creative.com/#contact', 'Contact')

They also mention that other website builders implement the o'clock code using a <href>.

We are not coders or developers. Does anyone know how to do this?

This topic has been closed for replies.

2 replies

Jon Fritz
Community Expert
Community Expert
October 24, 2016

That code they gave you would go inside the item you want to be trackable...

<a href="yourlinkhere.html" onClick="track_load('http://sandbox-creative.com/#contact', 'Contact')">YOUR LINK</a>

I don't know what "the o'clock code" would be, if it were a javascript, you would typically link it in the <head> section of your page, like so...

<script type="text/javascript" src="the_oclock_code_file.js"></script>

...or if it's a .css file, like so...

<link rel="stylesheet" type="text/css" href="the_oclock_css_file.css">

kglad
Community Expert
Community Expert
October 22, 2016

you would use javascript (js) to enable your click functionality.  because js functionality varies from browser to browser most coders use 3rd party libraries (eg, jquery) that remove much of that variation and simplify coding.