Try Snowplow and Google Tag Manager (GA4)

Hello,

I have just installed Try Snowplow and am setting it up on a staging environment of a single page app to start gathering some data, and see what’s possible before setting up Snowplow fully - to demo to the rest of the company.

It is working, in that I’m getting the initial page view and the page pings - but I’m not getting any more information as yet. I am aware this is because how the app is set up; and I think with Try Snowplow I cannot send custom events… though I may be wrong.

I saw in one of the other threads about integrating a Google Analytics plugin with Try Snowplow, and how that could be used with Google Tag Manager (which is what we use) - so I thought that sounded perfect for demo purposes. However, I’ve run into a bit of a snafu. We’re using Google Analytics: GA4 - and it seems like the code provided in the linked post is possibly for a different version, so adding it into the GTM just broke the GA tracking unfortunately.

I was wondering if anyone has any experience setting up Try Snowplow with GA4 and/ or has any advice on tracking custom events - mainly just clicking on things that aren’t links, so I can demo this to the team next week?

Thanks in advance,
Jo

Hi Jo! What type of custom events are you looking to track? Try Snowplow comes with a set of pre-defined custom data structures as part of the recipes. Specifically, there are:

  • a conversion event (details can be found in the Marketing Attribution recipe)
  • a product entity, a cart action event and a purchase event (details are in the E-commerce Analytics recipe)
  • a content entity (details are in the Content Analytics recipe)
  • a funnel interaction event (details are in the Funnel Analysis recipe)

You can also use any schemas found in Iglu Central. For example, you could use the link click schema to track other types of clicks. Alternatively, you can use our Structured Events, although we generally do not recommend using these in production as they don’t provide any of the benefits of our schema tech.

Let us know if you would like further help with this!

1 Like

Ah ha! I made the bad assumption that the recipes were just for analysing the data (which I haven’t gotten to yet) - and didn’t realise they had events I could use.

It is just simple things like clicking on a button, changing which product is being viewed.

I shall read the information you’ve helpfully provided, and circle back if I have any more questions.

Thank you!

Ok, so I’m getting mixed results from just trying to send a simple event.

I have the following in GTM which is triggered from a dataLayer event.

<script type="text/javascript">
  window.snowplow('trackSelfDescribingEvent', {
    "schema": "iglu:com.trysnowplow/conversion/jsonschema/1-0-0",
    "data": {
        "name": "change_item",
        "value": 0
    }
});
</script>

Which I adapted from Recipe: Marketing attribution - Snowplow Docs because I just wanted to have something recorded.

It is sending something (an “e” = “ue”) to the Snowplow tracker, but it’s not showing any of the event data in my database.

It is saving as an “unstruct” event in the database with an event name of “conversion”, but with no useful information (no name or value) - at this point I’d be happy with the event name just being saved so we could see usage.

I was having problems getting it to save - but I think that was a validation thing, because value needs to be a number.

Please help,
Thanks,
Jo

Hey Jo, Postgres follows our Redshift data structure. This means the fields from the custom events and entities are shredded out into child tables that you’ll need to join back onto the main atomic.events table:

        FROM atomic.events AS ev
        LEFT JOIN atomic.com_trysnowplow_conversion_1 AS c
            ON ev.event_id = c.root_id AND ev.collector_tstamp = c.root_tstamp

This is taken from the SQL example in the marketing attribution recipe.

If you suspect the events are failing validation, you can take a look at the Understanding bad data recipe find out why they are ending up in the bad queue!

2 Likes

Thank you! For some reason my DB explorer wasn’t showing atomic as a schema, so I wasn’t sure what tables were created. I knew I was missing something obvious (and now I feel silly).

Seriously, thank you!

2 Likes