Google Analytics

Google Analytics is an analytics service offered by Google that helps you monitor your web traffic.

To add Google Analytics to your website, you'll need a site-specific Google Analytics tracking code for your website.

Here's how to find and add your Google Analytics tracking code:

1. You can set up your Google Analytics account by visiting http://analytics.google.com. You'll need a valid Google account (Gmail accounts work).

2. Once your Google Analytics account is set up, you will need the Google Analytics tracking code. You’ll find your tracking code within your account:

  1. Select the "Admin" tab.
  2. Select a property (domain) from the dropdown in the "Property Column".
  3. Click “Tracking Info” > “Tracking Code”

Your tracking code will look something like the code you see below:

<!-- Global Site Tag (gtag.js) - Google Analytics -->

<scriptasyncsrc="https://www.googletagmanager.com/gtag/js?id=XX-XXXXX-X"></script>

<script><br>  window.dataLayer = window.dataLayer ||[];<br>  function gtag(){dataLayer.push(arguments);}<br>  gtag('js',newDate());<br><br>  gtag('config','XX-XXXXX-X');

</script>

Note: The X’s you see in the above sample code will be replaced with a unique code for your website. Be sure to copy the tracking code from your Analytics account.

4. Once you have your tracking code, add it to the Custom Scripts Header of your LawLytics website.

Note: We are happy to help you connect your Google Analytics account to your LawLytics website. To have LawLytics connect your Google Analytics account, email us at [email protected] with your tracking code.

5. Log into the LawLytics Control Panel.

6. Hover over “Publish” in the navigation at the top of your screen.

7. Select the site you’re adding Analytics to.

8. At the top of the left sidebar, click “Settings”.8. On the left side of the screen, click “Custom Scripts”.

9. Paste your Google Analytics Tracking Code into the Header.

Tracking Form Submissions with Google Analytics

Form submissions in LawLytics are handled via AJAX.  This means that rather than redirecting a visitor to a new page upon submitting a form, the visitor is instead presented with a confirmation message on their current page. The way Google Analytics observes these confirmation messages are different than redirecting the visitor to a new page, and so the code required to properly integrate those submissions with Google Analytics must be formatted differently.

While LawLytics provides you with a system for reviewing and managing these form submissions, it is also possible to do so with Google Analytics. However, since a submission does not result in a new page, you will need to create a virtual pageview when forms are submitted. The following example, using jQuery, may be added to your site's custom footer:

<script>
$('form').submit(function() { _gaq.push(['_trackPageview', '/thank-you']); });
</script>

A second method that may need to be used is below:

<script>
$('form').submit(function() { ga('send', 'pageview', '/thank-you.html'); });
</script>

This method may need to be used depending on which Google Analytics library you are using. If you are using an old library, the first option will work. If you are new to Analytics, we recommend using the second option, instead. You can test this by submitting a form submission to your own website once your code is implemented. Please contact us if you’re unsure how to do this.

If you have questions or require assistance with Google Analytics, please call us at (800) 713-0161 during our regular business hours, or email us at [email protected].