logo
logo

Google Tag Manager

Google Tag Manager is a free tool that manages marketing tags in marketing applications. Once configured in Sitecore Content Hub™, various information from Content Hub can be shared with other applications (for example, Analytics) through Google Tag Manager.

Activation

To start using Google Tag Manager with Content Hub, you need to add the container ID of your Google Tag Manager to the key field in Google Tag Manager configuration in Settings.

Note

To get the container id, log into your Google Tag Manager account and find the container id located on the top right side of the user interface.

Events

Content Hub automatically sends information about specific events and actions to Google Tag Manager.

NameEvent dataTriggering action
Changelifecycle
  • id: the entity Id
  • definition: the definition name
  • lifecycle: the new lifecycle status
Change the status of an entity (approve or reject).
Delete
  • id: the entity Id
  • definition: the definition name
Delete an entity.
Download
  • conversion: the rendition name
  • id: the entity Id
  • Definition: the definition name
Download an asset (one of the available renditions).
Draft
  • id: the entity Id
  • definition: the definition name
Create draft action on an entity.
Edit
  • section: the container name
  • id: the entity Id
  • definition: the definition name
Save changes after editing an entity/portal page.
Facet
  • facet: the label of the facet
  • definition: the taxonomy definition
Add a facet filter.
Fulltextsearch
  • searchterm: the full-text search value
Perform a full-text search.
Order
  • target: the target count
  • individualconversions: the number of individual conversions
The download order request is successful (status code: 201).
Pagesize
  • info: the size of the paging
Set the page size in the paging menu.
  • info: first
Go to first page.
  • info: previous
Go to previous page.
  • info: next
Go to next page.
  • info: last
Go to last page.
Pageview
  • culture: the culture of the page
  • page: the page object
Load a new page (any page).
Paging
  • info: the selected page index
Jump to a page.
Preview
  • id: the entity Id
  • definition: the definition name
Preview an asset.
Publish
  • id: the entity Id
  • definition: the definition name
Publish a theme or a portal version.
Querybuilder
  • field: the selected field name
  • operator: the selected operator name
  • searchterm: the search term values
Perform a query builder search.
Rating
  • score: the score
  • id: the entity Id
  • definition: the definition name
Save the user score (after rating an entity).
Search
  • query: the search query
  • count: the search results count
  • config: the search defaults
Perform a search.
Showmorefacets
  • facet: the facet field name
Get all facet values.
  • facet: the taxonomy label
  • definition: the taxonomy definition
Click on show more facets.
Sorting
  • direction: descending or ascending
  • field: the selected field
Perform a data sorting.
Upload
  • file: the file name
Upload a new file.
Note

All the events have an additional dynamic parameter named options that contains the page options and that is used for deriving the page name. For an example configuration file, see GTM-workspace-M-Events.json.

Analytics

If you want to send information about custom actions/events to Google Tag Manager, you can use the Analytics.log() method built into Content Hub.

For example:

Analytics.log = function (eventName, eventData, options) { ... }

In this example:

  • eventName: self-explanatory, does not use spaces, and everything is lowercase.
  • eventData: array of extra information or data you want to include for this event.
  • options: page options, which are optional and are used for deriving the page name.

Example: Lock event

The Lock event contains the id of the entity and the entity definition name. It also contains the page name the action is triggered from because this information is derived from the options.

Analytics.log("lock", { id: entity.systemProperties.id(), definition: entity.definition.name }, options);

Example: ChangeLifeCycle

The change life cycle event occurs upon approval or rejection. The event contains the entity's id, the definition name, and the lifecycle, for example, approve or reject and so on.

The page name is derived from the options parameter.

Analytics.log("changelifecycle", { id: sentity.systemProperties.id(), definition: sentity.definition.name, lifecycle: config.lifeCycle }, options);

Can we improve this article ? Provide feedback