Browse Source

[11.0][MIG] website_google_tag_manager: Migration to 11.0

pull/524/head
Cris Martín 1 year ago
parent
commit
4552b8f3b4
21 changed files with 197 additions and 212 deletions
  1. +3
    -0
      .gitignore
  2. +52
    -38
      website_google_tag_manager/README.rst
  3. +1
    -1
      website_google_tag_manager/__init__.py
  4. +25
    -0
      website_google_tag_manager/__manifest__.py
  5. +0
    -22
      website_google_tag_manager/__openerp__.py
  6. +2
    -2
      website_google_tag_manager/models/__init__.py
  7. +13
    -0
      website_google_tag_manager/models/res_config_settings.py
  8. +3
    -3
      website_google_tag_manager/models/website.py
  9. +0
    -12
      website_google_tag_manager/models/website_config_settings.py
  10. +5
    -0
      website_google_tag_manager/readme/CONFIGURE.rst
  11. +5
    -0
      website_google_tag_manager/readme/CONTRIBUTORS.rst
  12. +3
    -0
      website_google_tag_manager/readme/DESCRIPTION.rst
  13. BIN
      website_google_tag_manager/static/description/icon.png
  14. +0
    -79
      website_google_tag_manager/static/description/icon.svg
  15. BIN
      website_google_tag_manager/static/description/image.png
  16. +39
    -0
      website_google_tag_manager/views/res_config_settings_view.xml
  17. +0
    -23
      website_google_tag_manager/views/templates.xml
  18. +0
    -16
      website_google_tag_manager/views/website.xml
  19. +0
    -16
      website_google_tag_manager/views/website_config_settings.xml
  20. +30
    -0
      website_google_tag_manager/views/website_templates.xml
  21. +16
    -0
      website_google_tag_manager/views/website_views.xml

+ 3
- 0
.gitignore View File

@@ -56,3 +56,6 @@ docs/_build/

# Debug maps
*.css.map

# iOS
.DS_Store

+ 52
- 38
website_google_tag_manager/README.rst View File

@@ -1,65 +1,79 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================
Google Tag Manager
==================
==========================
Website Google Tag Manager
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
:target: https://github.com/OCA/website/tree/11.0/website_google_tag_manager
:alt: OCA/website
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/website-11-0/website-11-0-website_google_tag_manager
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/111/11.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to configure your Odoo website to support
the Google `Tag Manager <https://www.google.com/analytics/tag-manager/>`_ tool.

Configuration
=============
the `Google Tag Manager <https://marketingplatform.google.com/about/tag-manager/>`_ tool.

To configure this module, you need to:
**Table of contents**

* go to `Website Admin/Configuration`
* fill in your `Google Tag Manager Key` (e.g. `GTM-ABCDEF`)
.. contents::
:local:

.. figure:: website_google_tag_manager/static/description/image.png
:alt: alternative description
:width: 600 px

Usage
=====
CONFIGURATION
=============

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/186/9.0
#. Go to **Website > Configuration > Settings**
#. Check 'Google Tag Manager' option.
#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF').

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/website/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/website/issues/new?body=module:%20website_google_tag_manager%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Images
------
Contributors
~~~~~~~~~~~~
* `Sebastien Alix <sebastien.alix@osiell.com>`_

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* `Tecnativa <https://www.tecnativa.com>`_:

Contributors
------------
* Cristina Martin

* Sebastien Alix <sebastien.alix@osiell.com>
Maintainers
~~~~~~~~~~~

Maintainer
----------
This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/website <https://github.com/OCA/website/tree/11.0/website_google_tag_manager>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+ 1
- 1
website_google_tag_manager/__init__.py View File

@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models

+ 25
- 0
website_google_tag_manager/__manifest__.py View File

@@ -0,0 +1,25 @@
# Copyright 2016 ABF OSIELL <http://osiell.com>
# Copyright 2018 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Google Tag Manager",
"version": "11.0.1.0.0",
"author": "ABF OSIELL, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"category": "Website",
"website": "https://github.com/OCA/website",
"summary": "Add support for Google Tag Manager",
"depends": [
'website',
],
"data": [
"views/res_config_settings_view.xml",
"views/website_views.xml",
'views/website_templates.xml',
],
'images': [
'static/description/icon.png',
],
}

+ 0
- 22
website_google_tag_manager/__openerp__.py View File

@@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Google Tag Manager",
"version": "9.0.1.0.0",
"author": "ABF OSIELL, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Website",
"summary": "Add support for Google Tag Manager",
"depends": [
'website',
],
"data": [
"views/website_config_settings.xml",
"views/website.xml",
'views/templates.xml',
],
"auto_install": False,
'installable': True,
"application": False,
}

+ 2
- 2
website_google_tag_manager/models/__init__.py View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import website
from . import website_config_settings
from . import res_config_settings

+ 13
- 0
website_google_tag_manager/models/res_config_settings.py View File

@@ -0,0 +1,13 @@
# Copyright 2016 ABF OSIELL <http://osiell.com>
# Copyright 2018 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

google_tag_manager_key = fields.Char(
'Container ID',
related='website_id.google_tag_manager_key')

+ 3
- 3
website_google_tag_manager/models/website.py View File

@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ABF OSIELL <http://osiell.com>
# Copyright 2018 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields
from odoo import fields, models


class Website(models.Model):
_inherit = 'website'

google_tag_manager_key = fields.Char(u"Google Tag Manager Key")
google_tag_manager_key = fields.Char("Container ID")

+ 0
- 12
website_google_tag_manager/models/website_config_settings.py View File

@@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright 2016 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


class WebsiteConfigSettings(models.TransientModel):
_inherit = 'website.config.settings'

google_tag_manager_key = fields.Char(
related=['website_id', 'google_tag_manager_key'])

+ 5
- 0
website_google_tag_manager/readme/CONFIGURE.rst View File

@@ -0,0 +1,5 @@
To configure this module, you need to:

#. Go to **Website > Configuration > Settings**
#. Check 'Google Tag Manager' option.
#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF').

+ 5
- 0
website_google_tag_manager/readme/CONTRIBUTORS.rst View File

@@ -0,0 +1,5 @@
* `Sebastien Alix <sebastien.alix@osiell.com>`_

* `Tecnativa <https://www.tecnativa.com>`__:

* Cristina Martin R.

+ 3
- 0
website_google_tag_manager/readme/DESCRIPTION.rst View File

@@ -0,0 +1,3 @@
This module allows to configure your Odoo website to support the
`Google Tag Manager <https://marketingplatform.google.com/about/tag-manager/>`_
tool.

BIN
website_google_tag_manager/static/description/icon.png View File

Before After
Width: 128  |  Height: 128  |  Size: 9.2KB

+ 0
- 79
website_google_tag_manager/static/description/icon.svg
File diff suppressed because it is too large
View File


BIN
website_google_tag_manager/static/description/image.png View File

Before After
Width: 797  |  Height: 255  |  Size: 33KB

+ 39
- 0
website_google_tag_manager/views/res_config_settings_view.xml View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
Copyright 2018 Tecnativa - Cristina Martin R.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_website_config_settings" model="ir.ui.view">
<field name="name">Google Tag Manager</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='google_maps_setting']" position="after">
<div class="col-xs-12 col-md-6 o_setting_box" id="google_tag_manager_setting">
<div class="o_setting_right_pane">
<label for="google_tag_manager_key" string="Google Tag Manager"/>
<div class="text-muted">
Manage all your tags without editing code.
</div>
<div class="content-group">
<div class="row mt16">
<label class="col-md-4 o_light_label" for="google_tag_manager_key"/>
<field name="google_tag_manager_key" placeholder="GTM-XXXXX"
attrs="{'required': [('google_management_client_id', '!=', False)]}"/>
</div>
</div>

<div>
<a href="https://support.google.com/tagmanager/answer/6103696#install?hl=en"
class="oe_link fa fa-arrow-right" target="_blank">
How to get my GTM container ID
</a>
</div>
</div>
</div>
</xpath>
</field>
</record>

</odoo>

+ 0
- 23
website_google_tag_manager/views/templates.xml View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<template id="layout" inherit_id="website.layout">
<xpath expr="html/body/*[1]" position="before">
<t t-if="website and website.google_tag_manager_key">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe t-attf-src="https://www.googletagmanager.com/ns.html?id=#{website.google_tag_manager_key}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
</t>
</xpath>
<xpath expr="html/head" position="inside">
<t t-if="website and website.google_tag_manager_key">
<!-- Google Tag Manager -->
<script type="text/javascript">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','<t t-esc="website.google_tag_manager_key" />');</script>
<!-- End Google Tag Manager -->
</t>
</xpath>
</template>

</odoo>

+ 0
- 16
website_google_tag_manager/views/website.xml View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_website_form" model="ir.ui.view">
<field name="model">website</field>
<field name="inherit_id" ref="website.view_website_form" />
<field name="arch" type="xml">
<field name="google_analytics_key" position="after">
<field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
</field>
</field>
</record>

</odoo>

+ 0
- 16
website_google_tag_manager/views/website_config_settings.xml View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_website_config_settings" model="ir.ui.view">
<field name="model">website.config.settings</field>
<field name="inherit_id" ref="website.view_website_config_settings" />
<field name="arch" type="xml">
<div name="google_analytics_key" position="after">
<field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
</div>
</field>
</record>

</odoo>

+ 30
- 0
website_google_tag_manager/views/website_templates.xml View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<template id="layout" inherit_id="website.layout">
<xpath expr="//div[@id='wrapwrap']" position="before">
<t t-if="website and website.google_tag_manager_key">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe t-attf-src="https://www.googletagmanager.com/ns.html?id=#{website.google_tag_manager_key}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
</t>
</xpath>
</template>

<template id="web_layout" inherit_id="website.layout">
<xpath expr="//meta[@name='generator']" position="before">
<t t-if="website and website.google_tag_manager_key">
<!-- Google Tag Manager -->
<script type="text/javascript">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','<t t-esc="website.google_tag_manager_key" />');</script>
<!-- End Google Tag Manager -->
</t>
</xpath>
</template>

</odoo>

+ 16
- 0
website_google_tag_manager/views/website_views.xml View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_website_form" model="ir.ui.view">
<field name="model">website</field>
<field name="inherit_id" ref="website.view_website_form" />
<field name="arch" type="xml">
<field name="google_analytics_key" position="after">
<field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
</field>
</field>
</record>

</odoo>

Loading…
Cancel
Save