- Example Full Page /
- GA4 Example
Trackers GA4 ga.js Example {{ ga4}}
Documentation for UBC Library GA4 Google Analytics Tracker(s)
Your application will contain environment variables GA4_ID and Analytic in your .env file and in the dependencies.php allowing the tracker.js on cdn server to run.
Below is an example of the dependencies.php
$twigGlobals = [
'analytics' => $_ENV['ANALYTICS'] ?? false,
'ga4' => $_ENV['GA4_ID'] ?? "GA4_ID"
];
You can turn off google analytics by adding false to your Analytics enviroment variable
This script uses the environment variables from the application
<script src="https://cdn.library.ubc.ca/ga4/js/trackers-ga4.js"
data-id="lib-ga-trackers"
tracker_ga4_1= {{ga4}}
data-tracker2domain=" {{ base_url}} ">
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=" {{ga4}} " ?>"></script>
- Library Home
-
Hours & Locations
- UBC Vancouver
- Asian Library
- Biomedical Branch Library
- Chapman Learning Commons Help Desk
- The Chung | Lind Gallery
- David Lam Management Research Library
- Education Library
- Irving K. Barber Learning Centre
- Koerner Library
- Law Library
- Music, Art and Architecture Library
- Rare Books and Special Collections
- Research Commons
- University Archives
- Woodward Library
- Xwi7xwa Library
- UBC Virtual
- AskAway Chat Services
- Ask Us!
- Ask Us!
-
LOGIN
- Managing Your Account?
- My Library Account Login
- Need Citation Management?
- Citation Management Tools