Best practices on Product & Web data tracking

Prev Next

Are you looking into tracking your users' product activity to get a better understanding of their behavior? Would you like to start sending product activity or web visits to HG Insights but you haven't implemented tracking yet?
HG Insights doesn't collect data directly but it processes product and web activity sent from Segment, Amplitude, Mixpanel, or your Data Warehouse

Here are tips and best practices for implementing product & web visit tracking with these tools before sending them to HG Insights.

Tracking tools usually works with Identify calls (i.e. who is the user) and Track/Page/Event calls (i.e. what has the user done).  When these tools are connected to HG Insights, HG Insights will automatically pull both the Identify and Track/Page/Event. 

In which situations is it recommended to track users' behaviors?

You'll constantly be trying to identify users and track their activities. But the following situations are particularly important to detect:

  • When a user first registers

  • When a user logs in

  • When a user updates their info (for example, they change or add a new address)

  • When a user changes their pricing plan (purchase, upgrade, downgrade, cancel)

Learn more about the the type of events that can be used in a HG Insights behavioral model.

Best practices for Identifying users

After you've implemented Segment or Amplitude on your website or app, an Identify call is made to Segment or Amplitude. Essentially the website asks the tracking tool "who is this person?". The answer can be an anonymousID or a userID. Description attributes (also known as "traits" or "user properties") like email, name, plan, role, etc. can be passed in the identify call.  

Example of an answer (payload) of an Identify call,  

All the activities of that person will be associated with this anonymousID or userID.

Track the email of your users in Identify calls

HG Insights reconciles a person's activity across your different systems (Salesforce, HubSpot, Marketo, Segment, Amplitude, etc.) via the email. Each system would have a different userID, contactID, etc. but the identity of a person is unified at the email level. 

Example: here in Amplitude, the email margo.rey@madkudu.com has 3 different userIDs but thanks to the email we'll be able to reconcile all these user's activities to Margo. 

This is why a trait or user property that is necessary to pass in your identify call is the user email.  Without it, HG Insights won't be able to reconcile all activities to this person when scoring it. 

To be able to leverage product activities in your HG Insights behavioral models, you must always track the user email in the Identify traits.

 

How to check if you're already tracking the user email in Identify calls? 

In Amplitude 

  • Connect to your Amplitude account in the "Data" environment: data.amplitude.com

  • Navigate to Properties on the left navigation bar to access the list of user properties.

  • Search for email

  • Make sure the status is "Live"
     

In Segment 

  • Connect to your Segment account segment.com.

  • Navigate to Sources on the left navigation bar to access the different sites you're tracking.

  • Go to your website or app source. 


    mceclip3.png

  • Click on the Schema tab.

  • Search for the email trait.

  • Make sure the trait is active and not blocked. 

If you're just installing Segment or Amplitude, here is how to start tracking the email

Pre-requisite: you have access to your website or app code.

  • Follow

  • You should now have installed Segment's or Amplitude's JavaScript tracking code snippet on your website (i.e. copy-pasted into the HTML of your website by your web developer or added via Google Tag Manager) and checked if you are receiving data. 

  • On pages where you make identify calls, i.e. pages where a user can leave their email address (signup, login, gated content, contact us, etc.), you need to add the trait "email". This means the identify call present on your website or app pages code should now look like this:

    • Segment

analytics.identify(' {{user.id}} ',{
   email:'{{user.email}}'
});

where {{user.email}} is what you got from the login form and {{user.id}} is the ID of the user in your database. 

    • Amplitude

var identify = new amplitude.Identify().set('email', {{user.email}});
amplitude.getInstance().identify(identify);

Anonymous users and identified users

HG Insights will use any Segment or Amplitude event data generated by a known user with an email address.

Example: A user is browsing your website anonymously during their first session. Then during their 2nd session, this user submits a demo request form dropping their email, this user will now be associated with an email. If you have implemented Amplitude to be able to backfill data, then the email will be backfilled to the anonymous sessions. If not, HG Insights will only use the events that are performed in your product or website when the user and their email are known.

Going further on the topic: some resources 📚

When implementing Segment, we recommend browsing and reading these Segment resources:

When implementing Amplitude, you can check out these Amplitude articles: