this post was submitted on 11 Jun 2023
2 points (100.0% liked)

Free and Open Source Software

17930 readers
28 users here now

If it's free and open source and it's also software, it can be discussed here. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

Is anyone aware of FOSS alternatives to Google Tag Manager?

I have a really simple use case where I'm trying to find a solution that can trigger tags based on:

  • click class
  • click ID
  • click text

My tags simply fire javascript events to Plausible Analytics for tracking a few different web conversion scenarios.

In the past, I've tried Scale8 (it seems to have folded). I'm aware of Matomo's tag manager, but I already have an analytics solution, so I'm not really interested in deploying their analytics platform just for the tag manager plugin.

I recently came across RudderStack, but it doesn't seem to meet my simple needs. Or, if it does, its learning curve seems high.

top 2 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

If you’re still looking for a solution, have you thought about using a native JavaScript solution?

It could be as simple as placing a click listener on the body element of each page and then having a list of CSS selector rules. Matches is a JS function that you can pass a CSS selector too, so each click that occurs you can loop through an array of selectors.

Alternatively, that array of selectors could be the elements you attach the listeners to directly.

I’d be happy to help create some examples, if you have any extra context 👍

[–] [email protected] 1 points 1 year ago

That would be so amazing! I'd love to just accomplish this without any third-party dependency.

I have the ability to fire javascript on specific pages on my site, so this sounds like it may work!

For the benefit of the wider internet, I'll include the details of my triggers and tags here, but I'm going to DM you and send you the same details. Not sure how inter-instance DMing will work on Lemmy, so this is a fallback.

This is how I have the tags and triggers configured in GTM currently:

#1 Trigger: click class = single_add_to_cart_button button alt

Tag: plausible('Affiliate Click', {props: {product: document.title}});

#2 Trigger: Click Text matches RegEx (ignore case) view on etsy|view on amazon|view on society6

Tag: < plausible('Affiliate Click', {props: {product: document.title}});