Download the PHP package humanmade/hm-gtm without Composer

On this page you can find all versions of the php package humanmade/hm-gtm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hm-gtm

Google Tag Manager Tools

Google Tag Manager template tags and settings tool. Now supports Server Side GTM.

v3 Breaking Changes

There are some breaking changes in v3.0.0:

Usage

Once the plugin is installed and activated there are 2 places you can configure:

  1. On the general settings page in admin add your container ID eg. GTM-123ABC
  2. For a multisite install you can set a network wide container ID on the network settings screen

Server Side GTM

You can optionally specify the following:

  1. Server container URL - this should the absolute path to the server container, even if you are using a reverse proxy.
  2. Custom code snippet - this is a block of code that will be added to the <head> of the page. Some server side container providers have subtle or extensive changes to the standard GTM snippet so you can override it fully if needed.
  3. Cookie preservation - you can set a special UUID cookie that lasts a long time, some server side providers allow restoring cookies set by 3rd parties or client side code in this way.

No script fallback

NOTE: This is not needed for block themes.

If your theme is a classic theme, and you wish to support the fallback iframe for devices without javascript, add the following code just after the opening <body> tag in your theme:

Data Layer

GTM offers a dataLayer which allows you pass arbitrary data that can be used to modify which tags are added to your site.

This plugin adds some default information such as page author, tags and categories and provides a simple filter for adding in your own custom key/value pairs.

Find out more about using the dataLayer variable here.

You can explore and view the dataLayer variables by previewing your container and using the overlay on your website.

Custom event tracking

In the block editor you can add event tracking to any block via the settings panel in the block sidebar. This calls dataLayer.push() with the event data specified.

All blocks are opted in to support this by default, but you can set block support to false with the following during block registration, or via block.json. For example:

By default the plugin will look for elements with special data attributes in your markup and listen to the specified event to push events to the data layer.

The data attributes are:

Example:

There is also a helper function to return these data attributes called get_gtm_data_attributes().

To deactivate custom event tracking use the following code:


All versions of hm-gtm with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ^1.0 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package humanmade/hm-gtm contains the following files

Loading the files please wait ....