Skip to main content
OCLC Support

Use Google Analytics 4 in CONTENTdm

Find information about using Google Analytics 4 in CONTENTdm.

Learn how to use Google Analytics 4 in CONTENTdm. For the older Universal Analytics, please see Use Google Analytics 4 in CONTENTdm

CONTENTdm supports Google Analytics 4 (GA4), Google’s next-generation analytics tool. Support for the older Universal Analytics (UA) will run parallel with GA4 until its end-of-life date of July 2023. 

Add Google Analytics 4 support to your site

Before the EOL date for UA, you can track your site’s activities with either or both Universal Analytics (UA) and GoogleAnalytics 4 (GA4). You can include Tracker IDs of one or both Google Analytics versions in your Website Configuration Tool.

First, create a property in your Google Analytics account.

Note the Tracking ID, referred to as the Measurement ID for GA4. The ID starts with the G-. This is not the property ID, but the tracking ID or measurement ID. Refer to Tracking ID support.

  1. Sign in to the CONTENTdm Website Configuration Tool.
  2. Navigate to Global Settings > Analytics & SEO > Google Analytics
  3. If you are tracking your site activities in UA, the Google Analytics Tracker ID field should contain a Tracker ID starting with UA-:
    • Example: UA-#########
  4. To track in both UA and GA4, add the GA4 Tracker ID, starting with G-, to the Google Analytics Tracker ID field with a comma to separate the two IDs and no space in between:
    • Example: UA-#########,G-#########
  5. To only track in GA4, add a single GA4 Tracker ID to the Google Analytics Tracker ID field:
    • Example: G-#########
  6. Click Save and Publish

Per Google, it can take up to 30 minutes for data to begin appearing in your new GA4 property. Some reports can take 24-48 hours to appear.

About custom dimensions in GA4

Once you add GA4 tracking to your website, you can start to use the real-time data and some of the standard reports to view and analyze your data. Refer to Understanding Google Analytics Reports (GA4). You can also set up custom dimensions to track additional data CONTENTdm supports to collect more meaningful data specific to your CONTENTdm collections. Refer to Custom dimensions and metrics (GA4).

GA4 tracks:

  • event_name
  • event_parameters

For example, to understand how the Download function is used, only tracking how often the Download button is clicked is not as informative. Instead, knowing which items users are downloading will be much more meaningful. In GA4, the download clicking event has event parameters attached to it, such as collection_id, item_id, and download label, which will tell you more information about the downloads. 

Set up these event parameters with the specific events to create custom dimensions. Afterward, use these custom dimensions to generate custom reports to help you visualize your analytics data.

In GA4, the event name is the top-level way of identifying events. In CONTENTdm, examples of these names are search and download item.  

GA4 allows us to send additional event parameters along with events. These can vary based on the event name. View these event parameters in the Realtime view when you drill down into events. To be able to drill down into their values over the longer-term analysis views in Google Analytics, as well as to build custom reports based on them, it is necessary to add custom dimensions for each unique event parameter.

Once added, new events will have those parameters processed as custom dimensions, and those values will be usable in reports.

Event parameters

Below is a list of event parameters that CONTENTdm supports. Add the desired event parameters for tracking. The most important event parameters that we recommend customers add are collection_alias,  item_id, and query.  If compound objects are used, parent_id is also recommended.

Dimension name (you can specify your own name)

Description

Scope

User Property/Parameter

Collection

The collection ID of the item in question

Event

collection_alias

Download_label

The label of the download button when it is clicked

Event

download_label

Item

The item ID

Event

item_id

Item type

Whether an item is a single item or compound object

Event

item_type

Item_url

The URL of a URL stored as an item in CONTENTdm, which a user visits via CONTENTdm

Event

item_url

Language

The language a user selects for viewing CONTENTdm

Event

language

Link

A custom (customer-configured) link the user clicks in the header

Event

link

Page

Which page a user was on when they used the pagination controls

Event

page

Query

The user's search query

Event

query

Size

The size of an image being downloaded

Event

size

Source

The source of a link being clicked, either the footer or hamburger menu

Event

source

Title

The title of a PDF being expanded

Event

title

Type

The type of the event. Used for type of pagination control interacted with, and type of search performed.

Event

type

Count

A numerical value the user selected

Event

count

Format

The format of the data chosen by the user

Event

format

Parent_id

The ID of the parent object in use cases involving compound objects

Event

parent_id

Parent_title

The title of the parent object in use cases involving compound objects

Event

parent_title

 Note: Not all of these custom parameters are sent for all events. Each individual event may have zero or a few custom parameters sent with it.

Below is a list of the events with the associated parameters indicated:

Action

event_name

event_parameters

User clicks Home in breadcrumbs link breadcrumbs:home  
User clicks collection name in breadcrumbs link breadcrumbs:collection collection_alias: (collection_alias)
User clicks collection card from home page open collection collection_alias: (collection_alias)
User clicks Browse button on collection browse collection collection_alias: (collection_alias)
User clicks Save star on item save item

collection_alias: (collection_alias)

item_id: (item_id)

User changes language in footer change language language: (language name)
User clicks Home in footer home link source: footer
User clicks About in footer about link source: footer
User clicks Browse in footer browse link source: footer
User clicks Log In in footer log in link source: footer
User clicks Log Out in footer log out link source: footer
User clicks the home link in the header (logo or title) home link source: header
User clicks a custom link in the hamburger menu custom link

link: (url of custom link)

source: header

User clicks the hamburger menu that opens the hamburger menu open hamburger menu none
User clicks Home in hamburger menu home link source: hamburger menu
User clicks Browse in hamburger menu browse link source: hamburger menu
User clicks About in hamburger menu about link source: hamburger menu
User clicks Log in in hamburger menu log in link source: hamburger menu
User clicks Log out in hamburger menu log out link source: hamburger menu
User enters a page number in the page number box for a compound object select compound item page 

collection_id: (collection_id)

parent_id: (parent_id)

parent_title: (parent_title)

page: (page)

source: entered page number

User downloads an item that isn't an image via the download dropdown download item

collection_id: (collection_id)

item_id: (item_id)

download label: (message)

User downloads a single item that isn't an image via the download dropdown download item

collection_id: (collection_id)

item_id: (item_id)

item_type: (single or compound)

User clicks the download dropdown on a non-image compound object (but hasn't downloaded the item yet) open download menu

collection_id: (collection_id)

item_id: (item_id)

User clicks the download dropdown on an image (but hasn't downloaded the item yet) open download menu

collection_id: (collection_id)

item_id: (item_id)

item_type: (single or compound)

User downloads an image download item

collection_id: (collection_id)

item_id: (item_id)

item_type: (single or compound)

size: (size of image)

User prints something print

collection_id: (collection_id)

item_id: (item_id)

item_type: (single or compound)

User opens print menu open print menu

collection_id: (collection_id)

parent_id: (parent_id)

item_id: (item_id)

User clicks the share button share button

collection_alias: (collection_alias)

item_id: (item_id)

User clicks previous/next arrows on item navigation buttons

type: (previous/next)

collection_alias: (collection_alias)

item_id: (item_id)

record_number: (record_number)

 

User plays audio play audio

collection_alias: (collection_alias)

item_id: (item_id)

User downloads an item that cannot be previewed (not PDF, not audio, not image, etc.) download item

collection_id: (collection_id)

item_id: (item_id)

User clicks the Expand button on an image expand image

collection_id: (collection_id)

item_id: (item_id)

record_id: (record_id)

User clicks the Expand button on a PDF expand PDF

collection_alias: (collection_alias)

item_id: (item_id)

User clicks on a URL for a URL item type visit URL item

item url: (URL of URL item)

collection_alias(collection_alias)

item_id: (item_id)

User clicks play on a video item play video

collection_id: (collection_id)

item_id: (item_id)

User clicks next/previous from lightbox expanded view in compound object expanded navigation buttons

direction: (previous/next)

collection_alias: (collection_id)

item_id: (item_id)

record_number: (record_id)

User makes use of pagination controls pagination

type: (previous/next/page number)

page: (The props.pageInfo.trackPage value)

User makes a simple search search

query: (query)

type: simple

User clicks Advanced Search link open Advanced Search

none

User clicks on a facet in the search results select search facet

title: (title)

User clicks on a different page in a compound object in order to view it select compound item page

collection_alias: (collection_alias)

parent_id: (parent_id)

item_id: (item_id)

source: clicked on page

The selected/viewed item of a compound object changes due to the user selecting Filtered while viewing an object that doesn't match the filter select compound item page

collection_alias: (collection_alias)

parent_id: (parent_id)

parent_title: (parent_title)

item_id: (item_id)

source: changed to filtered view

The user selects Show All/Filtered while viewing a compound object via search results switch display mode

collection_alias: (collection_alias)

parent_id: (parent_id)

type: (either Filtered or Show All)

The user clicks a metadata link click metadata link

link: (link text)

The user searches within an item (the Search this record) box search within item

collection_alias: (collection_alias)

parent_id: (parent_id) (only if applicable)

item_id: (item_id)

query: (query)

The user clicks the < or > arrows around the "Result 4 of 10" box to switch between items from search results or browsing a collection move to next result

type: (previous result or next result)

collection_alias: (collection_alias)

item_id: (item_id)

The user selects a different page in a compound or monograph item whose parent is a monograph select compound object

collection_alias: (collection_alias)

parent_id: (parent_id)

item_id: (item_id)

type: monograph

The user clicks a custom link in the footer custom link

link: (url of link)

source: footer

The user clicks select all or deselect all in their saved items page saved items: select all

One of:

  • select
  • deselect
The user clicks the remove button in their saved items page saved items: open remove items

 

The user clicks cancel on the remove items popup after clicking remove saved items: cancel remove items

 

The user clicks confirm on the remove items popup after clicking remove saved items: confirm remove items

 

The user is on saved items without being logged in, clicks the log in link on the save page

log in link

source: saved items

The user clicks the Create link button in Saved Items.

(This is the first step of that workflow)

saved items: open create link

 

The user clicks Cancel in the Create link dialog

saved items: cancel create link

 

The user clicks Create link on the Create Link modal

saved items: create link

 

The user clicks Copy link on the Link Created page after having created a link

saved items: copy created link

 

The user clicks OK on the Link Created page after having created a link

saved items: close link created modal

 

The user cancels out of the Link Created page by clicking anywhere on the page outside of the modal

saved items: cancel link created modal

 

The user clicks Export from the Export Items dialog in Saved Items

export items: items exported

format: (HTML or text)

The user chooses a different format in the dropdown on the Export Items dialog

export items: select format

format: (HTML or text)

The user clicks the Save all or Remove all button above the search results

save/remove all search results

 

The user changes the sort order above their search results

change search sort

type: (field) (direction)

The user clicks the Grid VIew or List View button above the search results

search result display mode changed

type: (grid or list)

The user clicks on a search result when the results are in Card View/Grid View

search result clicked

collection_alias: (collection_alias)

item_id: (item_id)

type: (grid or list)

The user changes how many search results display per page

search results per page changed

count: (new number)

The user changes the sort order while in mobile/narrow window view

change search sort

type: (field) (direction)

The user removes one of the filters above their search results

remove search filter

query: (value of filter)

The user selects on one of their items with the check box to its left while viewing their saved items

select saved item

type: (select or deselect)

collection_alias: (collection_alias)

item_id: (item_id)

The user clicks on one of their items while viewing their saved items (not the check box, to view it)

view saved item

type: (select or deselect)

collection_alias: (collection_alias)

item_id: (item_id)

Add Custom Dimensions

To add custom dimensions:

  1. Sign in to your GA4 property.
  2. Select Configure from the left pane, which expands when you mouse over it.
  3. From the Configure screen, click on Custom definitions.
  4. Click on the Create custom dimensions button.  
    • You will not initially have any custom dimensions, but once created, they will appear in the table under the Custom dimensions tab.
  5. Add the custom dimension.
    • The Event parameter must match the parameters that OCLC is sending via CONTENTdm. Refer to the Event Parameter column in the above list of Event parameters table.
    • The Scope must be Event (default).
    • Dimension name is what it will appear as in your Google Analytics instance.
    • Description is optional and for your reference only.
  6.  Once you have added the custom dimension, it will show up in your list of Custom Dimensions.
  7.  Repeat this process for all of the other CONTENTdm custom parameters.

Once you have added custom dimensions, events that GA4 receives that have the specified custom parameters will now have those processed as custom dimensions and will be available both in GA4 default reports (in the Reports section), as well as in custom reports you build in the Explore section of GA4.

 Note: It takes 24-48 hours for the events with custom dimensions to start showing up in the Reports and Explore sections. This is a Google Analytics limitation.