User Source In the Data Layer

Our Listeners automatically generate data layer activity whenever activity occurs on your website or application, including every time a user begins a session. Check out the example data layers from our User Source Listener.

User Source Data Layer Examples

Learn more about how ListenLayer generates powerful data layers from the activity on your website, specifically from visitors’ traffic source.

Custom Data Layer Events

The User Source Listener generates a single data layer event called “userSource” whenever a visitor begins a session on your website. Use this event to build triggers or customize data using Google Tag Manager.

event: 'userSource'

Automatic Data Layer Values

ListenLayer pushes critical information from your User Source activity into the data layer automatically. For example, this code to the right shows an example of data pushed into the data layer when a new traffic source is identified for an existing user.

You can see this visitor originally came from Google Organic but has just now arrived by clicking on a Google Ad.

Using Google Tag Manager, all data layer values can be captured inside marketing platforms or as variables.

sourceAutomaticValues {
    source: 'Google Ads',
    lastUserSource: 'Google Organic'
    sourceLocation: {
        url: 'https://www.listenlayer.com/?gclid=1234',
        tld: 'listenlayer.com',
        hostname: 'www.listenlayer.com',
        "pathname: '/',
        queryString: '?gclid=1234',
        parameters: {
            gclid: 1234
        },
        fragment: null,
        protocol: 'https',
        originPathName: 'https://www.listenlayer.com/'
    },
    url: {
        query: 
            gclid: 1234
        }
    } 
}

Custom Data Layer Values

ListenLayer allows you to write rules that generate powerfully custom data layer values within the User Source Listener. With this feature, data collection and marketing analytics becomes nearly limitless!

For example, while ListenLayer automatically identifies the user’s traffic source, we don’t group sources into a medium automatically. Instead, you can write a simple rule to group all of your possible User Source values and push the result into the data layer using a new variable, such as userMedium.

The possibilities are endless! Once you realize the power of customization with Listeners, you’ll never go back!

sourceCustomValues: {
    //custom variable values display here based on rules you write
    userMedium: 'Organic Search'
  },