Skip to main content
All CollectionsGetting started
Set up user attribution in June
Set up user attribution in June

Learn how to properly track user signups and marketing attribution in June.

Updated over a week ago

Overview

To accurately track user conversions and attribute them to marketing campaigns, you'll need to:

  1. Track page views with properties and UTM parameters

  2. Link anonymous visitors to signed-up users

  3. Bypass adblockers with a reverse proxy

All of these steps work with both the June and Segment SDKs, because our SDK is a fork of the Segment one.

Track page views with properties and UTM parameters

June and Segment SDKs automatically track page views with some default properties like path, url, title, and referrer, when you add the following tracking call in your app's frontend:

analytics.page('Pricing');

You can track more properties by passing an object to the second argument of this tracking call:

analytics.page('Pricing', { name: 'Pricing' });

UTM parameters can tell you where incoming traffic is coming from and help you understand what aspects of your marketing campaigns are driving traffic. When a visitor arrives on your site, both SDKs will automatically parse the URL’s query strings, and store them within the context object of the page view tracking calls. These parameters do not persist to subsequent calls unless you pass them explicitly like this:

analytics.page("Pricing", {}, {
campaign: {
name: "TPS Innovation Newsletter",
source: "Newsletter",
medium: "email",
term: "tps reports",
content: "image link"
},
});

Link anonymous visitors to signed-up users

When a user signs up, it's crucial to send both their new userId and their previous anonymousId in the identify call and the signup track event, because it helps us connect their landing page journey to their product journey.

If you identify a user and track events for them from your app's frontend, their anonymousId is automatically assigned to them in all tracking calls, and all of them would look like this:

analytics.identify(userId, {
email: '[email protected]'
})

analytics.track('Signed up')

But if you track event in your app's backend (which we highly recommend to avoid adblockers), you'll need to pass the anonymousId for a user from the frontend to the backend as a query parameter in order to track it in the backend tracking calls.

On your app's frontend, you can access the anonymousId with this helper method:

analytics.user().anonymousId()

Pass it as a query parameter to your backend, and then track both the userId and anonymousId together like this:

Analytics.identify(
user_id: current_user.id,
anonymous_id: params['anonymous_id'],
traits: { email: '[email protected]' }
)

Analytics.track(
user_id: current_user.id,
anonymous_id: params['anonymous_id'],
event: 'Signed up'
)

Bypass adblockers with a reverse proxy

Some of your customers might have adblockers installed which will prevent their tracking calls from flowing in and lead to an incomplete picture overall. This is why we recommend that you keep most of your tracking calls on your app's backend to avoid adblockers altogether.

Since it's really hard to move your page view tracking calls to the backend, we suggest that you use a reverse proxy to send all your frontend tracking calls to us through your own domain so that they're not blocked by adblockers.

You can go through this doc to set it up.


And that's mostly it! You can get a complete picture of your customers' journey, even before they sign up to your product if you follow all of these steps.

Did this answer your question?