Solved

How do I add default event properties to a custom event?

  • 22 December 2023
  • 2 replies
  • 178 views

Hello, everyone.

I’m start to study Amplitude for the integration with my project.

I have trying to add default event properties such as PageDomain, PageTitle, PagePath, etc. to my custom event.

I have using default events such as PageViewed, Start Session, etc. in my project, but from my requirements I need to define custom event.

I’d like to use default properties such as PageDomain, PageTitle, PagePath, etc. in my custom event.

What’s suggestion to add these properties to my custom event ?

I hope to anyone help me for this.

Thank you.

icon

Best answer by paladin8 22 December 2023, 21:34

View original

2 replies

Userlevel 4
Badge +2

Hi Phoenix, you’ll have to add those properties yourself to the event you want to instrument. Fortunately, that’s pretty straightforward. You can look at exactly how our SDK extracts these properties from the window `location` here and mimic it: https://github.com/amplitude/Amplitude-TypeScript/blob/c87f8bead0ff7330ff39c9c5a8698ddb65f5eb8e/packages/plugin-page-view-tracking-browser/src/page-view-tracking.ts#L26

Great !!!


That’s works for me.


hank you for your help.

Reply