Thanks for your patience during our recent outage at scalar.usc.edu. While Scalar content is loading normally now, saving is still slow, and Scalar's 'additional metadata' features have been disabled, which may interfere with features like timelines and maps that depend on metadata. This also means that saving a page or media item will remove its additional metadata. If this occurs, you can use the 'All versions' link at the bottom of the page to restore the earlier version. We are continuing to troubleshoot, and will provide further updates as needed. Note that this only affects Scalar projects at scalar.usc.edu, and not those hosted elsewhere.
Scalar 2 User's GuideMain MenuGetting StartedExplains account and book creation, and some interface basics.QuickStartsA path of all QuickStart content in this user's guide.Working with MediaHow to get the most out of your use of media in Scalar.Working with ContentCreating and editing content in Scalar.Working with WidgetsWorking with StructureHow to use Scalar's many options for structuring publications.Editorial WorkflowHow to use features for performing editorial review of content.VisualizationsExploring the contents of a book visually.LensesAn introduction to lenses, a tool for searching and visualizing Scalar content.Advanced TopicsDescribing Scalar's more advanced features.Third Party Plugins and Platforms
Adding Google Analytics tracking (Javascript)
12020-09-20T12:19:00-07:00Craig Dietrich2d66800a3e5a1eaee3a9ca2f91f391c8a689349032965Convert a Google Analytics embed snippet to Javascript for placing in Scalar's Custom JS boxplain2020-09-20T12:27:37-07:00Craig Dietrich2d66800a3e5a1eaee3a9ca2f91f391c8a6893490The toughest part of Google Analytics is navigating the Google Analytics' Dashboard. The goal is to create a new "property" for the domain of the Scalar book. This will generate an embed snippet that looks like this:
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-ABCDEFGHIJK"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push( arguments);} gtag('js', new Date()); gtag('config', 'G-ABCDEFGHIJK'); </script>
In a typical website, you would place this at the top of your site's HTML, inside the head tag. For Scalar, the principle is the same, however, you'll place it in the Custom JavaScript box in Scalar's Dashboard. The problem is, however, that the Custom JavaScript bo in Scalar's Dashboard expects pure JavaScript—HTML tags are not allowed—so the embed snippet above needs to be adjusted a little bit.
First, make note of the Google Analytics code that is present in two places in the above snippet. For this example, that code is "G-ABCDEFGHIJK". Take that code and place it into the following, adjusted snippet:
$.getScript("https://www.googletagmanager.com/gtag/js?id=G-ABCDEFGHIJK", function() { window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-ABCDEFGHIJK'); });
Now, take this adjusted snippet and cut-and-paste into the Custom JavaScript box in Scalar's Dashboard. That's it! You should start seeing results in Google Analytics after 12-24 hours.
This page has paths:
1media/scalar-rdf-controller-node-method.PNG2014-10-01T16:38:30-07:00Erik Loyerf862727c4b34febd6a0341bffd27f168a35aa637Advanced TopicsCurtis Fletcher35Describing Scalar's more advanced features.image_header2021-02-24T09:45:06-08:00Curtis Fletcher3225f3b99ebb95ebd811595627293f68f680673e