Skip to content

Google Tag Manager Intergation

License

Unknown, GPL-2.0 licenses found

Licenses found

Unknown
LICENSE.rst
GPL-2.0
LICENSE_GPL.rst
Notifications You must be signed in to change notification settings

bluedynamics/bda.plone.gtm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bda.plone.gtm

Google Tag Manager Integration.

Installation and Configuration

  • Depend your installation to bda.plone.gtm.
  • Install bda.plone.gtm via Plone Add-ons control panel.
  • Naviagte to "Site Setup" -> "Add-on Configuration" -> "Google Tag Manager Settings".
  • Set "Enabled" checkbox and enter "Container ID". Optionally edit "Layer Name" to your needs. This integration package handles the layer name properly. Anyway you need to be aware that any 3rd party JS using this package may depend hardcoded to the default layer name, so be careful with changing this setting.

Providing Data

bda.plone.gtm by default tracks nothing. To track something useful, bda.plone.gtm.interfaces.IGTMData adapters needs to be provided for the relevant context.

The adapter implementation looks like:

from a.package.interfaces import IMyContextInterface
from bda.plone.gtm.interfaces import IGTMData
from zope.component import adapter
from zope.interface import implementer

@implementer(IGTMData)
@adapter(IMyContextInterface)
class MyContextGTMData(object):

    def __init__(self, context):
        self.context = context

    @property
    def data(self):
        # data is a dict or a list of dicts.
        return {
            'pageTitle': 'Home',
            'visitorType': 'high-value'
        }

Register the data adapter:

<configure xmlns="http://namespaces.zope.org/zope">

  <!-- GTM data adapter -->
  <adapter factory=".data.MyContextGTMData" />

</configure>

Contributors

  • Robert Niederreiter (Author)

About

Google Tag Manager Intergation

Resources

License

Unknown, GPL-2.0 licenses found

Licenses found

Unknown
LICENSE.rst
GPL-2.0
LICENSE_GPL.rst

Stars

Watchers

Forks

Packages

No packages published

Languages