Understanding Lytics / Integrations

Google Analytics

Out of the box Lytics has the ability to pass all public audiences as a Custom Dimension to Google Analytics. This allows for global filters based on Lytics audiences to be applied to reports, custom views and nearly every aspect of your existing Google Analytics account.

Google Analytics Integration Hero

This article covers:

Before you Begin

Passing Lytics audiences to Google Analytics requires that the Lytics JavaScript tag be installed on your site. Make sure you've followed the instructions for configuring and installing the tag before proceeding. Also keep in mind any Lytics audience you would like to access in Google Analytics must be API enabled, this will ensure the Javascript tag can pass the audience membership to GA.

Authentication

  1. Navigate to the Google Analytics tile in the integrations section of your Lytics Account. google analytics
  2. Click Setup Dimensions from the top of the integration page.
  3. Click the gray Add Account button toward the upper right hand side of the next screen.
  4. When prompted, log in to the account you wish to authorize and follow the steps per Google's directions. Google Analytics Oauth
  5. Once you have finished authorizing a Google account enter a Description. This description allows you to differentiate authorizations within your Lytics account. It should be descriptive of the user or account that authorized it to prevent confusion as additional authorizations for the same tool(s) are added. Keep in mind, this is only visible from your Lytics account. Google Analytics Description

Setup Custom Dimensions

  1. Once you have authorized, click Setup Custom Dimensions.
  2. From the Choose an Account dropdown select the account to set up. This menu will be populated with all Google Analytics accounts the authorization has access to.
  3. From the Choose a web property dropdown select the appropriate web property you wish to configure.
    • Note: Each web property will need its own Google Authorization and integration configuration. For more advanced Google Analytics implementations please contact support.
  4. Click Start Setup and Lytics will create two Custom Dimensions within your Google Analytics account. Likewise, visitor information will begin to flow into your Google Analytics account via the Lytics JavaScript tag.

Advanced Setup

Advanced options are reserved for special cases or advanced users and are not required for the base installation. Please proceed with caution.

  1. The next dropdown menu allows you to select existing Dimensions to pass Lytics audiences into. This is not recommended but available to accounts who have reached the maximum number of Custom Dimensions.
  2. The next dropdown menu allows you to select existing Dimensions to pass Lytics User Ids. This is not recommended but available to accounts who have reached the maximum number of Custom Dimensions.
  3. If you have a Google Analytics 360 account, select the checkbox labeled Do you have a Google Analytics 360 account? This means you can create up to 200 custom dimensions, instead of 20.
  4. Using the Export Fields configuration Lytics has the ability to pass additional data into Google Analytics. The Lytics support team ([email protected]) should be consulted prior to configuring this field in order to ensure your account will allow for it.

Configure Google Analytics Account

The final step is to configure the display of Lytics audiences within your Google Analytics account. For full details on how to leverage Custom Dimensions across the Google Analytics environment please consult Google's documentation.

Create Google Analytics Segments from Lytics Data

  1. From your Audience Overview inside of Google Analytics select Add Segment towards the top. Google Analytics Overview
  2. Select the red + New Segment button at the top of the list of existing Google segments.
  3. In the following window name your segment. This is what will appear in your reporting and across your Google Analytics interface.
  4. Under Advanced select Conditions. This allows you to create Google Segments from Custom Dimensions.
  5. Select the dropdown meny that sets the dimension, (often this will default to Ad Content) and from the drop down menu expand Custom Dimensions then click on the Lytics Audiences dimension. Lytics audiences custom dimension
  6. In the text input to the right of contains type in the id of your audience. This can be found on the Lytics audience overview next to the full audience name. In the example screen shot mobile_web_visitor would be used as the audience id. Note that the audiences you use must be API enabled. Audience id
  7. Finally, save your Google segment and you are done. You can now activate or deactivate this segment at any time to filter all aspects of your Google Analytics dashboard. Google Analytics Filter

Lytics Event Override

By default the Lytics Google Analytics integration will fire a Google Analytics event on each page load. This ensures all audience data is associated with the visitor and received by Google. In the event that a customer would like to prevent this additional event on page load Lytics offers a custom override. This override will prevent Google Analytics from sending the initial "page view" event until Lytics audiences have been set properly each time a visitor views a page.

Please note, this is an advanced configuration and should only be approached if your Google account has a cap on events sent.

  1. Contact Lytics support ([email protected]) to blacklist the native Google Analytics integration. This is required in order to prevent duplicate events.
  2. Alter the Google Analytics Website Tracking tag. The default Google Analytics Website Tracking tag automatically triggers a "pageview" after it has been loaded. In order to prevent the additional Lytics event this event call must be removed. To do so, simply remove the following line from the default Google Analytics Website tracking code: ga('send', 'pageview');
  3. Install the following Lytics Google Analytics integration snippet. This code should be located just below your Google Analytics Website Tracking code.

    <script>
        !function(l,a){a.liosetup=a.liosetup||{},a.liosetup.callback=a.liosetup.callback||[],a.liosetup.addEntityLoadedCallback=function(l){if("function"==typeof a.liosetup.callback){var o=[];o.push(a.liosetup.callback),a.liosetup.callback=o}a.lio&&a.lio.loaded?l(a.lio.data):a.liosetup.callback.push(l)}}(document,window);
        !function(e,n){var i=function(e){ga(function(){for(var e=ga.getAll(),i=[],a=0,t=e.length;a<t;a++){var o=e[a].get("trackingId"),g=e[a].get("name");o&&i.push({name:g,id:o})}for(a=0;a<n.lio.integrationsConfig.googleAdsIntegration.length;a++)for(var l=n.lio.integrationsConfig.googleAdsIntegration[a],d=0;d<i.length;d++)if(l.web_property===i[d].id){var g=i[d].name;n.ga(g+".require","displayfeatures"),n.ga(g+".set",l.segments_dimension,n.lio.segmentsString),n.ga(g+".set",l.user_id_dimension,n.lio._uid),ga("send","pageview")}})};n.liosetup&&"function"==typeof n.liosetup.addEntityLoadedCallback?n.liosetup.addEntityLoadedCallback(i):console.warn("unable to add Lytics callback, missing callback handler")}(document,window);
    </script>

    Here is a full example denoting the proper load order:

    <html>
        <head>
            <!-- Google Analytics Website Tracking -->
            <script>
              (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
              (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
              m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
              })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
              ga('create', 'UA-35220005-2', 'auto');
              // ga('send', 'pageview'); <--- this is the line you will comment out or remove
            </script>
    
            <!-- Lytics Google Analytics Integration -->
            <script>
              !function(l,a){a.liosetup=a.liosetup||{},a.liosetup.callback=a.liosetup.callback||[],a.liosetup.addEntityLoadedCallback=function(l){if("function"==typeof a.liosetup.callback){var o=[];o.push(a.liosetup.callback),a.liosetup.callback=o}a.lio&&a.lio.loaded?l(a.lio.data):a.liosetup.callback.push(l)}}(document,window);
              !function(e,n){var i=function(e){ga(function(){for(var e=ga.getAll(),i=[],a=0,t=e.length;a<t;a++){var o=e[a].get("trackingId"),g=e[a].get("name");o&&i.push({name:g,id:o})}for(a=0;a<n.lio.integrationsConfig.googleAdsIntegration.length;a++)for(var l=n.lio.integrationsConfig.googleAdsIntegration[a],d=0;d<i.length;d++)if(l.web_property===i[d].id){var g=i[d].name;n.ga(g+".require","displayfeatures"),n.ga(g+".set",l.segments_dimension,n.lio.segmentsString),n.ga(g+".set",l.user_id_dimension,n.lio._uid),ga("send","pageview")}})};n.liosetup&&"function"==typeof n.liosetup.addEntityLoadedCallback?n.liosetup.addEntityLoadedCallback(i):console.warn("unable to add Lytics callback, missing callback handler")}(document,window);
            </script>
        </head>
        <body>
        </body>
    </html>

Lytics Event Override with Google Tag Manager

For those who are using Google Tag Manager the steps are slightly different due to how load order and integrations are handled within that tool.

** IMPORTANT NOTE ** This integration will not work for those using the built in Google Analytics tag within Google Tag Manager. When installing Google Analytics this way you remove all ability to prevent a "pageview" event from being sent before your Lytics Audiences have been passed to Google.

Google Analytics Tile

Configure Google Analytics

  1. Under the Tags menu click the red New button to create a new tag container.
    Create New Container
  2. Click Choose a tag type to begin setup... and select Custom HTML from the list.
    Custom HTML Container
  3. Within this container you will place your Google Analytics tracking tag as instructed in step 2 of the Lytics Event Override docs above. Essentially we are just copying and pasting from Google Analytics and then removing the ga('send', 'pageview'); line so that we do not send the pageview data before all data has been set with Google.
    GA Tag Example
  4. Under the advanced settings adjust the Tag Firing Priority to be 10 for this tag. The higher the number the sooner the script runs.
  5. Configure when the tag is triggered. This is likely going to be All Pages but is dependent on execution details.
    Tag Firing Priority
  6. Name and save your tag.
    Save Tag

Configure Lytics Tag

  1. Under the Tags menu click the red New button to create a new tag container.
    Create New Container
  2. Click Choose a tag type to begin setup... and select Custom HTML from the list.
    Custom HTML Container
  3. In this tag you will paste the "Lytics Google Analytics Integration" from step 3 of the Lytics Event Override docs above.
    Lytics GA Tag
  4. Under the advanced settings adjust the Tag Firing Priority to be 9 for this tag. This ensures Lytics will run after Google Analytics has been initialized.
  5. Configure when the tag is triggered. This is likely going to be All Pages but is dependent on execution details. This must match the targeting used in the Google Analytics container otherwise your GA tag will not fire.
    Tag Firing Priority
  6. Name and save your tag.
    Save Tag

At this point everything should be configured. Publishing your the latest version of your tag manager should result in audiences being passed into your Google Analytics account without sending additional unnecessary events.

Verifying the Integration

A very simple way to test that everything is working properly is to use the "Google Analytics Debugger" Chrome extension from Google. When activated all of the data that is being passed to Google will also be output in your Google Developer Console. You will simply need to look for the Lytics audiences list in your event as seen here:

Connect Google Analytics to AdWords

Now that you have Lytics audiences flowing into Google Analytics, you can use those audiences to create groups to target with Google AdWords. If you have not completed setting up Google Analytics, please complete setup before continuing.

Adding Lytics Core Remarketing Audiences

  1. To create a new remarketing group, start in the Google Analytics Admin section, expand Remarketing under the Property column, and select Audiences. app
  2. Click on New Audience to get started.
  3. On the Link Configuration step, choose a web property that has your Lytics tracking tag on it, and select the AdWords account that you want the audience that you are building to show up in. app
  4. Click Next Step. You can either add custom audiences that you created in Lytics or add the Lytics Core Remarketing Audiences by importing them from Google's Solutions Gallery.
  5. To import the Lytics Core Remarketing Audiences, select Import Segment and search for Lytics. Select Import for the Lytics Core Remarketing Audiences. app

Adding custom Lytics audiences

In addition to adding the Lytics Core Remarketing Audiences, you can add custom audiences that you have created in Lytics.

  1. On the Define Audience step, instead of selecting Import Segment, select Create New. app
  2. From the Audience Builder screen, select Conditions under Advanced on the right-hand side. app
  3. To access the Lytics audiences, expand the first drop down menu and find Lytics Audiences. app
  4. When you click on the empty text box, Google Analytics will populate an example list to choose from. Each element on the list will be a combination of different Lytics audiences that Google Analytics has seen attached to individual visitors.
  5. To target a specific Lytics audience, leave the second drop down box at contains and type in the id of the Lytics audience that you want to match. Once you have the id entered, click out of the box (otherwise Google will select the first line that matches what you entered). app You can use Lytics audiences along with any other tools in the Audience Builder to create the audience that you want to target.
  6. When you're done, select Apply.
  7. From there you can see how many people Google has seen matching this audience definition in the last 7 days, indicate how long a person remains a part of this audience, give the audience a name, and, when you're done, click Save.

Note: You must complete the first part of the Google Analytics integration in Lytics and let it run for long enough for Google to collect Lytics audience information from your site visitors before Google will show any matches to Lytics audiences. Depending on your site traffic, this could take hours or days.

app

Any audiences that you create this way become part of the Shared Library in AdWords allowing you to use them as part of your advertising campaigns.

app