Statistics on number of clicks per store/dealer

Hi, to impress our dealers with usage and clicks that we generate for them via this tool, we would like the option to see (only in the backend) the number of clicks (over time as well) per store/dealer found via our dealerportal.

2 Likes

Hi there and welcome to the Community, @user30992 :waving_hand:

Would you like to track clicks on the location markers and the corresponding locations in the side panel separately, or would you prefer to count them together as one?

For example, if you click on the Lumar Verhuur marker and then click on Lumar Verhuur in the side panel, should both clicks be counted as just 2 clicks on Lumar Verhuur? Or should they be identified as 1 click on Lumar Verhuur marker and 1 click on Lumar Verhuur in the side panel?

1 Like

Hi Max, thank you for getting back! Well, if you can identy the 2 seperately, that would be awewome.

Would it also be possible to, separately, see the amount of clicks to their website, via the URL provided in their card?

Thx, Dennis

2 Likes

Got it, thanks!

I am not sure if it’s feasible, but I’ll discuss it with the devs and will update you once I have their response :slightly_smiling_face:

1 Like

Our devs can create a custom code for tracking clicks through the Google Analytics. Would you like to proceed this way?

If so, could you please specify the name of your Store Locator widget, where you’d like to track clicks?

1 Like

I think that would be great! i created 2 locators, they are the same, only the language is different. So the results of the 2 can be combined in one pool of data

2 Likes

Got it, thanks!

I’ve passed it on to the devs and will update you once the solution is ready :wink:

1 Like

Hi there, @user30992 :waving_hand:

Unfortunately, there is no way to track clicks on markers, but our devs created a code for side panel and website URLs clicks.

Please add this part of the code to your website <head>:

<script async src="https://www.googletagmanager.com/gtag/js?id=*G-ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ID');
</script>

In the code above, you need to replace G-ID with your actual website ID for Google Analytics. This article will help you find your ID - Find your Google tag ID.

And then just add the rest of the script to the Custom JS field on the Settings tab of your widget’s settings

function sendEvent(label, locationName) {
  const config = {
    action: 'click',
    category: 'Store Locator',
    label,
    locationName
  };

  if (typeof ga !== 'undefined') {
    ga('send', 'event', {
      eventAction: config.action,
      eventCategory: config.category,
      eventLocation: config.locationName,
      eventLabel: config.label
    });
  }
  if (typeof gtag !== 'undefined') {
    gtag('event', config.action, {
      event_category: config.category,
      event_location: config.locationName,
      event_label: config.label
    });
  }
}

document.addEventListener('click', ({ target }) => {
  if (!target) {
    return;
  }

  const isWebSite = target.closest(
    '[class*="location-card__Container-sc"] [class*="contacts-item__UnderlineWrapper-sc"][href*="http"]'
  );
  if (isWebSite) {
    const locationName = document.querySelector('[class*="multi-column-layout__Column-sc"] [class*="business-info__Block-sc"] div');
    sendEvent(`Click to WebSite: ${target.textContent}.`, locationName.textContent);
  }

  const sideBarLocation = target.closest('.es-location-preview-image');
  if (sideBarLocation) {
    const locationName = sideBarLocation.querySelector('.es-location-preview-title');
    sendEvent(`Click to sidebar location`, locationName.textContent);
  }
});

This article explains where you can find the click stats -Google Analytics 4 (GA4): Where to find my events - Elfsight Help Center

Please let me know if it helps and if you have any other questions :slightly_smiling_face:

1 Like