We use lightning communities. I am working on building a new LWC component, where I can place it in the page footer. The goal of the component is simple: once the user logs in, visits a page in the community - capture user info and network info and insert the information in a custom object.
I am using createrecord wire service to insert a new record. On research, I found out that I have 2 options for lifecycle hooks.
renderedCallback() does insert the record but it runs multiple times; tried to use
initialRender but with no luck.
connectedCallback() does not create the record.
What is the recommended approach so that a visit can be captured?