Help Center
How can we help? 👋

Setting up User Tracking for GA4

How to set up user tracking for GA4

Centori developed a way to cookie users who visit your website so that we can provide attribution reporting to see where users are coming from and how many leads SEO really drives for your business.

To set up attribution reporting in Centori, you need to follow the following steps:

  1. Add our tracking script to your website
  1. Set up Google Tag Manager to send the cookie we create to Google Analytics
  1. Configure Google Analytics to accept the cookie

And you’re all set! If you get stumped or have questions please reach out to us for support and we will happily help you set this up.

Add our script to your website

First, place this code on your website. This is a link to our user tracking script which sets a cookie (labeled “centori_tracking”) which will cookie individual visitors to your website.

We’ll use this to report on the users who visit your website in our GA4 reports.

<!-- Centori GA4 User Cookie tracking script -->
<script src="https://centori-static.nyc3.digitaloceanspaces.com/code/centori_tracking.js"></script>

Set up Google Tag Manager To Send the Cookie to GA4

Now we need to make two quick changes in Google Tag Manager to relay the cookie to Google Analytics. This will allow Google Tag Manager to send the cookie that Centori is creating to GA4 (and allow us to get that data back for each user on your website).

Create a first party cookie variable

In Google Tag Manager create a new variable to store the cookie our script creates. This allows us to Google Tag Manager to send the cookie value to Google Analytics.

Click the Variable section of the side menu, and create a new 1st Party Cookie variable. We recommend naming it “Centori Cookie.”

Notion image

Hook up the cookie to your Ga4 configuration

⚠️
The rest of this process requires you to use Google Tag Manager to configure Google Analytics. If you are manually embedding your Google Analytics code to your website, we recommend using Google Tag Manager instead.

Once your variable is set up, edit your Google Analytics configuration to send it to Google Analytics.

There are 2 parts to this:

  • Setting a configuration parameter
  • Setting a user property

Set the configuration parameter

First, set a configuration parameter like so:

Create a new one with the name “user_id” and the value for the “Centori Cookie” variable you created.

Notion image

If you can set a user properties below, do so like this:

If your Google Tag configuration supports the ability to set user properties, then you can add a property like below the parameters you just set. Give the property the name “centori_user_id” and the value of the “Centori Cookie” variable:

Notion image

If you cannot set a user setting parameter, do this instead

If your Google Tag configuration does not support the ability to add User Properties directly in the configuration settings and only supports Event Settings, then you will want to create a new Event Settings variable. First, select to create a new variable like so:

Notion image

This will open up a new side panel to create the variable. In the variable you can set a User Property with the name “centori_user_id” and the value of your “Centori Cookie” variable:

Notion image

Once the event settings variable is created, make sure that the Google Tag is using your event settings variable:

Notion image

And you’re done with the Google Tag Manager side of the setup!

💬
Got questions or need help? Reach out to us in Slack for help or to schedule a setup call.

Set up Google Analytics

99% of the work is done, now we just need to make sure that Google Analytics is set up to accept this new user id and you’re all set!

Click on the Admin settings icon (gear in the bottom lefthand corner) then open up the Data Display sidebar menu and select Custom Definitions.

Notion image

Create a new custom definition with the values:

  • UserID for dimension name
  • User for scope
  • centori_user_id for the User property/parameter

And you’re all set!

Did this answer your question?
😞
😐
🤩