How to track on page interactions
On page interactions can help track a wide array of custom actions that happen while a user is on your piece of content.
This could be tracking a user clicking a buy now button, hitting next on an image carousal, clicking a logo and many more.
With Nudge, you can set this up simply once you have the full Nudge Tracking JS on your page.
- Have the full Nudge code on the page you wish to track interactions on.
- Interactions feature is turned on within your account.
On page interactions you've set up will, by default, be tracked against the URL they occur on, and as such will show up in a table on the single content view below the traffic sources list.
There are a number of ways you can add and track interactions on your content by simply firing the
ndg() function call.
Interaction tracking on a button or link...
The simpliest way to add interaction tracking is to add an onclick fuction to your button or link that calls Nudge.
<button onclick="ndg('interaction name');">Testing</button>
<a href="http://google.com/" target="_blank" onclick="ndg('interaction name');">Click Here</a>
Please note: The punctuation inside the code is very important, we highly recommend asking your developer to implement this, or talk to the Nudge team if you are confused at all.
To test that you have set up your interactions correctly, you can do so through using the Chrome developer tools.
- Open the page you have set up the interactions on using the Google Chrome browser and open up the developer tools. (Right click anywhere on the page and select Inspect Element)
- Once you have the developer tools open, select the Network tab.
- In the search input, search for the interaction name you used. If the the event was successful you will see pixel called v.gif being sent that contains your Interaction details.
In the above example, we've used an event called Img Mouse Over. i.e. ndg('Img Mouse Over'). Searching for the word over has brought up the fired event confirming it was fired successfully.
The most common causes for an interaction not being sent are usually due to stylized apostrophe. Make sure your apostrophe for the event are not stylized. ie ' instead of `