Google Analytics Code Generator

Google Analytics Tracking Code Generator (Analytics.js)

*Google no longer supports the ga.js tracking library and now operates using Universal Analytics. Generate your new, updated code below for the best results.

UA Number: *Required



*Press to copy GA tracking code

The Google Analytics Tracking Code allows Google to quickly scan data on each page of your website and send it back to your Analytics report for the best and most accurate data yet.

To find your tracking ID, (UA-XXXXX-Y), click Admin, select Property Settings, then Tracking Info > Tracking Code. You’ll find your tracking ID at the top of the page. Copy and paste your tracking ID into the code generator for your new, updated code.

Where to Place Your Tracking Code:
Copy and paste your Analytics.js tracking code on every page of your website, as the first item in the head tag.

Google Analytics Event Tracking Code Generator

*This tool creates an onclick Event snippet for analytics.js, and may not be valid format for gtag.js.

Category: *Required

Action: *Required

Label: *Recommended

Value: *Optional, but a Label must be set

OnClick Event: onClick="ga('send', 'event', {{categoryOut}}{{actionOut}}{{labelOut}}{{valueOut}});"
*Press to copy GA OnClick Event code

Event tracking is used to record specific interactions users have with individual functions throughout your entire website. For example, track downloads, video plays and blog subscriptions as Google Analytics Events.

Input your desired Category, Action, Label, and Value into the Google Analytics Event tracking code generator to receive your custom snippet. Check out Google’s Help Center for more information about the Anatomy of an Event.

Where to Place Your Tracking Code:
Copy the OnClick Event code and add it as an “onClick” attribute to the HTML of the page you wish to track clicks.