Google Analytics assigns the traffic source to a user’s location before entering a session; however, it won’t track the user’s first contact with your website if intermediary pages or sessions are present. catch initial traffic source with Google Analytics. To discern the initial traffic source of users, Google Tag Manager proves invaluable.
Thank you for reading this post, don't forget to subscribe!Understanding the need to track the “initial” traffic source is crucial. While Google Analytics showcases source data on your website, this information is not entirely accurate. Google Analytics relies on sessions, which are not effective in identifying the original source that brought users to your site. To address this, you can set up mechanisms using Google Tag Manager to track the initial source of a user.
The process involves creating a custom JavaScript Tag in Google Tag Manager. This Tag collects data such as UTM parameters, referral data, and other source-related information, storing it in a first-party cookie. Configuring this Tag involves creating a Custom HTML Tag, adding the script code in the HTML tab, and setting up an All Pages trigger.
Catch initial traffic source with Google Analytics
To ensure the Tag works correctly, use the Preview mode in Google Tag Manager and check the cookie configurations in the browser’s developer settings. The cookie, named “initialTrafficSource,” will contain information about the UTM campaign source. Testing involves searching your website on Google and verifying the correct functioning of the cookie.
Creating a user-defined variable is essential for interpreting the initial source data. Configure a 1st Party Cookie variable in Google Tag Manager with the cookie name as “initialTrafficSource.” Refresh the preview mode and website to see the variable section displaying data recovered from the cookie.
For further integration, a custom dimension is created in Google Analytics. Navigate to Admin Settings → Custom Definitions → Custom Dimensions → New Custom Dimension. Add the name as “initial Traffic Source” and set the scope as User. Update the Google Analytics Settings variable with the dimension value and configure the dimension in the variable.
To ensure the proper sequencing of Tags, modify the Tag sequencing in the Google Analytics preview Tag settings. The custom HTML Tag should fire before the Google Analytics Tag. Testing involves deleting stored data from the cookie, enabling the Google Tag Assistant Chrome extension, and refreshing the website page.
Upon successful implementation, the initialTrafficSource cookie will indicate the initial traffic source. This data is crucial for understanding how users arrive on a page without coming through planned referral sources. The process is validated by checking Google Analytics Pageview Requests and examining the custom dimension value.
In Google Analytics, navigate to Acquisition → Source/Medium to view the sources of various visitors on your website. By adding a Secondary dimension as the Initial Traffic Source, you can see not only the last known source but also the initial source for the traffic on your website.
It’s essential to note that data from the sources may take up to 24 hours to appear, and Real-Time reports won’t display custom dimensions. Limitations include dependence on cookies, potential self-referral issues in cross-domain tracking, and the inability to retroactively track historical movements of users who visited the website before configuring cookie settings. For a more robust solution, consider configuring the initial traffic source to the Data Layer with the help of a developer.