Is it possible to change event_name from structed events?

Hi guys,

I have a lot of events that is equal to trackPageView event, but i need to add a custom name to it, for example:

trackPageView comes with event_name=page_view. I need a trackPageView with event_name=chosen_name;

There is a way to do that other than create a selfdescribing event? As it uses the same attributes that comes along with a predefined event trackPageView, it would be a waste of time make a schema just to change name.

No, not that I’m aware of. Are you using a single page application? Trying to understand the use case here.

No, i’m not using a spa. I’ll try to explain what is going on.

We need to track several events on our products and the data team made a csv with what they think are the events that we need to make better decisions, better products… I need to code those events. The problem is: they want a lot of events that the attributes are the same as those in trackPageView, attribs such as: collector_tstamp, dvce_created_tstamp, dvce_sent_tstamp, etl_tstamp, etc.

For example: let’s suppose that we have an event on csv, created by them, called ‘account_created’, with the same attribs as in trackPageView event, but we need to distinguish the event by it’s name. We need to find account_created in redshift for example.

We are migrating from segment and there, we could create an event with a chosen name, description, add our attributes if needed. In this particular case of this question, i need to send the same attributtes as in trackPageView and be able to find this sent event with the name i chose, ‘account_created’ for example.

If you want to keep things simple, you could track structured events as described here:

These events will still capture all the data points you mentioned above, plus things like the page_url and such.
I’d suggest you continue capturing the page view event, thats pretty important but you can also capture your other data points with strucutred events.

Usually the action property of a structured event is the one which is used to describe the event name. It’s good practice to give them a category too so that events can easily be grouped together.

Structured Events do have some downsides over building your own schemas and sending self describing events, or sending your page views with additional context, but given the use case you describe they could be the simple solution you are looking for.

If you want to read a little more about structured vs unstructed events, this is a useful place to start: https://snowplowanalytics.com/blog/2020/01/24/re-thinking-the-structure-of-event-data/

I was thinking of using structed events. Once i don’t wanna add new attributes, i think trackStructEvent will be a better approach than trackSelfDescribingEvent.

Thank’s for the answer. You guys are helping me a lot these days!

1 Like

I’d only stress that you seriously consider making your own schema, you can tailor it to exactly what you need it to be. I think its one of the greatest aspects of Snowplow and should be leveraged here.

1 Like