forked from OCA/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] New module 'website_google_tag_manager' (OCA#278)
* [ADD] New module 'website_google_tag_manager' * [FIX] website_google_tag_manager - Added OCA as author * [FIX] website_google_tag_manager - Fix RST syntax error (duplicate implicit target name 'google tag manager') * [IMP] website_google_tag_manager - Replace 'openerp' tags by 'odoo' ones + Remove 'data' tags
- Loading branch information
1 parent
bfb3ddd
commit 63535be
Showing
11 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.. 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 | ||
================== | ||
|
||
This module allows to configure your Odoo website to support | ||
the Google `Tag Manager <https://www.google.com/analytics/tag-manager/>`_ tool. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
* go to `Website Admin/Configuration` | ||
* fill in your `Google Tag Manager Key` (e.g. `GTM-ABCDEF`) | ||
|
||
.. figure:: website_google_tag_manager/static/description/image.png | ||
:alt: alternative description | ||
:width: 600 px | ||
|
||
Usage | ||
===== | ||
|
||
.. 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 | ||
|
||
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. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Sebastien Alix <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- 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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import website | ||
from . import website_config_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- 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 Website(models.Model): | ||
_inherit = 'website' | ||
|
||
google_tag_manager_key = fields.Char(u"Google Tag Manager Key") |
12 changes: 12 additions & 0 deletions
12
website_google_tag_manager/models/website_config_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- 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']) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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'?'&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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
16 changes: 16 additions & 0 deletions
16
website_google_tag_manager/views/website_config_settings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_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> |