Track clicks on your links using Google Analytics

Lisa Fockens Updated by Lisa Fockens

On your Wisepops dashboard, we display the total number of clicks on the links and calls-to-action with tracking activated.

In some situations, you might want to track the number of clicks on each link.

To do so, we're going to use our JS callback feature.

Step 1:

Open your popup in the editor.

Step 2:

In the left menu click on "JS":


Step 3:

Click on "Add new script"


Step 4:

Select "After tracked click" and copy/paste the following script, for GA4:

gtag('event', 'Wisepops CTA click', {
label: event.target.textContent
});

Still using the legacy Universal Analytics? Use this snippet instead:

ga(function () {
var trackingIds = [];
ga.getAll().forEach(function (tracker) {
if (trackingIds.indexOf(tracker.get('trackingId')) === -1) {
trackingIds.push(tracker.get('trackingId'));
ga(
tracker.get('name') + '.' + 'send',
'event',
'Wisepops',
'Click CTA',
event.target.textContent
);
}
});
});

And voilà!

Don't hesitate to contact our support if you have any questions.

Use Google Analytics to analyze Wisepops impact on your sales (Universal Analytics)

Contact