diff --git a/setup/website_sale_google_tag_manager/odoo/addons/website_sale_google_tag_manager b/setup/website_sale_google_tag_manager/odoo/addons/website_sale_google_tag_manager new file mode 120000 index 0000000000..d8176e4e7f --- /dev/null +++ b/setup/website_sale_google_tag_manager/odoo/addons/website_sale_google_tag_manager @@ -0,0 +1 @@ +../../../../website_sale_google_tag_manager \ No newline at end of file diff --git a/setup/website_sale_google_tag_manager/setup.py b/setup/website_sale_google_tag_manager/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_sale_google_tag_manager/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_sale_google_tag_manager/README.rst b/website_sale_google_tag_manager/README.rst new file mode 100644 index 0000000000..90ed9675a9 --- /dev/null +++ b/website_sale_google_tag_manager/README.rst @@ -0,0 +1,105 @@ +======================================= +Google Tag Manager Enhanced Conversions +======================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/15.0/website_sale_google_tag_manager + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-15-0/e-commerce-15-0-website_sale_google_tag_manager + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/e-commerce&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to configure your Odoo eCommerce to support the Google Tag Manager +Enhanced Conversions. Read more about them in this link: https://support.google.com/google-ads/answer/9888145?hl=en&ref_topic=3165803 + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Go to **Website > Configuration > Settings** +#. Search 'Google Tag Manager' option. +#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF'). +#. Set 'Enhanced Conversions' on. + +With it you can configure your GTM conversion scripts for ``/shop/confirmation`` +with the following xpath options: + +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_email']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_name']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_street']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_city']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_zip']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_region']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_country']`` + +Only if you have ``partner_firstname`` installed, you can also use: + +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_firstname']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_lastname']`` + +Otherwise you should figure out how to split ``customer_name`` in you js tag scripts. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `__: + + * David Vidal + * Pilar Vargas + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_google_tag_manager/__init__.py b/website_sale_google_tag_manager/__init__.py new file mode 100644 index 0000000000..69f7babdfb --- /dev/null +++ b/website_sale_google_tag_manager/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/website_sale_google_tag_manager/__manifest__.py b/website_sale_google_tag_manager/__manifest__.py new file mode 100644 index 0000000000..62d139c641 --- /dev/null +++ b/website_sale_google_tag_manager/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Google Tag Manager Enhanced Conversions", + "summary": "Add support for Google Tag Manager Enhanced Conversions", + "version": "15.0.1.0.0", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "category": "eCommerce", + "website": "https://github.com/OCA/e-commerce", + "depends": ["website_sale", "website_google_tag_manager"], + "data": ["views/res_config_settings_view.xml", "views/website_templates.xml"], + "images": ["static/description/website_google_tag_manager.png"], +} diff --git a/website_sale_google_tag_manager/i18n/website_sale_google_tag_manager.pot b/website_sale_google_tag_manager/i18n/website_sale_google_tag_manager.pot new file mode 100644 index 0000000000..fa87b17f99 --- /dev/null +++ b/website_sale_google_tag_manager/i18n/website_sale_google_tag_manager.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_google_tag_manager +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_sale_google_tag_manager +#: model:ir.model,name:website_sale_google_tag_manager.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: website_sale_google_tag_manager +#: model:ir.model.fields,field_description:website_sale_google_tag_manager.field_res_config_settings__google_tag_manager_enhanced_conversions +#: model:ir.model.fields,field_description:website_sale_google_tag_manager.field_website__google_tag_manager_enhanced_conversions +msgid "Enhanced Conversions" +msgstr "" + +#. module: website_sale_google_tag_manager +#: model:ir.model.fields,help:website_sale_google_tag_manager.field_res_config_settings__google_tag_manager_enhanced_conversions +#: model:ir.model.fields,help:website_sale_google_tag_manager.field_website__google_tag_manager_enhanced_conversions +msgid "" +"This will provide the necessary data in the confirmation page that GTM needs" +" to gather in order to be able to use Enhanced Conversions. The template can" +" be edited if more info is needed in the future." +msgstr "" + +#. module: website_sale_google_tag_manager +#: model:ir.model,name:website_sale_google_tag_manager.model_website +msgid "Website" +msgstr "" diff --git a/website_sale_google_tag_manager/models/__init__.py b/website_sale_google_tag_manager/models/__init__.py new file mode 100644 index 0000000000..74b81abfff --- /dev/null +++ b/website_sale_google_tag_manager/models/__init__.py @@ -0,0 +1,2 @@ +from . import website +from . import res_config_settings diff --git a/website_sale_google_tag_manager/models/res_config_settings.py b/website_sale_google_tag_manager/models/res_config_settings.py new file mode 100644 index 0000000000..1c2c148b93 --- /dev/null +++ b/website_sale_google_tag_manager/models/res_config_settings.py @@ -0,0 +1,11 @@ +# Copyright 2021 Tecnativa - David Vidal +# 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_enhanced_conversions = fields.Boolean( + related="website_id.google_tag_manager_enhanced_conversions", readonly=False + ) diff --git a/website_sale_google_tag_manager/models/website.py b/website_sale_google_tag_manager/models/website.py new file mode 100644 index 0000000000..a1cfe3b9f0 --- /dev/null +++ b/website_sale_google_tag_manager/models/website.py @@ -0,0 +1,14 @@ +# Copyright 2021 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class Website(models.Model): + _inherit = "website" + + google_tag_manager_enhanced_conversions = fields.Boolean( + string="Enhanced Conversions", + help="This will provide the necessary data in the confirmation page that GTM " + "needs to gather in order to be able to use Enhanced Conversions. The " + "template can be edited if more info is needed in the future.", + ) diff --git a/website_sale_google_tag_manager/readme/CONFIGURE.rst b/website_sale_google_tag_manager/readme/CONFIGURE.rst new file mode 100644 index 0000000000..2653f841de --- /dev/null +++ b/website_sale_google_tag_manager/readme/CONFIGURE.rst @@ -0,0 +1,24 @@ +To configure this module, you need to: + +#. Go to **Website > Configuration > Settings** +#. Search 'Google Tag Manager' option. +#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF'). +#. Set 'Enhanced Conversions' on. + +With it you can configure your GTM conversion scripts for ``/shop/confirmation`` +with the following xpath options: + +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_email']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_name']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_street']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_city']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_zip']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_region']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_country']`` + +Only if you have ``partner_firstname`` installed, you can also use: + +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_firstname']`` +- ``//div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_lastname']`` + +Otherwise you should figure out how to split ``customer_name`` in you js tag scripts. diff --git a/website_sale_google_tag_manager/readme/CONTRIBUTORS.rst b/website_sale_google_tag_manager/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..c99262ebf9 --- /dev/null +++ b/website_sale_google_tag_manager/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `__: + + * David Vidal + * Pilar Vargas diff --git a/website_sale_google_tag_manager/readme/DESCRIPTION.rst b/website_sale_google_tag_manager/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..23fb42edd0 --- /dev/null +++ b/website_sale_google_tag_manager/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to configure your Odoo eCommerce to support the Google Tag Manager +Enhanced Conversions. Read more about them in this link: https://support.google.com/google-ads/answer/9888145?hl=en&ref_topic=3165803 diff --git a/website_sale_google_tag_manager/static/description/icon.png b/website_sale_google_tag_manager/static/description/icon.png new file mode 100644 index 0000000000..2dffdc61f0 Binary files /dev/null and b/website_sale_google_tag_manager/static/description/icon.png differ diff --git a/website_sale_google_tag_manager/static/description/index.html b/website_sale_google_tag_manager/static/description/index.html new file mode 100644 index 0000000000..07270bf9cc --- /dev/null +++ b/website_sale_google_tag_manager/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +Google Tag Manager Enhanced Conversions + + + +
+

Google Tag Manager Enhanced Conversions

+ + +

Beta License: AGPL-3 OCA/e-commerce Translate me on Weblate Try me on Runboat

+

This module allows to configure your Odoo eCommerce to support the Google Tag Manager +Enhanced Conversions. Read more about them in this link: https://support.google.com/google-ads/answer/9888145?hl=en&ref_topic=3165803

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Website > Configuration > Settings
  2. +
  3. Search ‘Google Tag Manager’ option.
  4. +
  5. Fill in your ‘Google Tag Manager Key’ (e.g. ‘GTM-ABCDEF’).
  6. +
  7. Set ‘Enhanced Conversions’ on.
  8. +
+

With it you can configure your GTM conversion scripts for /shop/confirmation +with the following xpath options:

+
    +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_email']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_name']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_street']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_city']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_zip']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_region']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='shipping_country']
  • +
+

Only if you have partner_firstname installed, you can also use:

+
    +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_firstname']
  • +
  • //div[@id="gtm_enhanced_conversion_data"]/span[@name='customer_lastname']
  • +
+

Otherwise you should figure out how to split customer_name in you js tag scripts.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • David Vidal
    • +
    • Pilar Vargas
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/e-commerce project on GitHub.

+

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

+
+
+
+ + diff --git a/website_sale_google_tag_manager/static/description/website_google_tag_manager.jpg b/website_sale_google_tag_manager/static/description/website_google_tag_manager.jpg new file mode 100644 index 0000000000..06fed75ff7 Binary files /dev/null and b/website_sale_google_tag_manager/static/description/website_google_tag_manager.jpg differ diff --git a/website_sale_google_tag_manager/views/res_config_settings_view.xml b/website_sale_google_tag_manager/views/res_config_settings_view.xml new file mode 100644 index 0000000000..37433a632a --- /dev/null +++ b/website_sale_google_tag_manager/views/res_config_settings_view.xml @@ -0,0 +1,28 @@ + + + + + res.config.settings + + + +
+
+
+
+
+
+
+
diff --git a/website_sale_google_tag_manager/views/website_templates.xml b/website_sale_google_tag_manager/views/website_templates.xml new file mode 100644 index 0000000000..4669a5bd0c --- /dev/null +++ b/website_sale_google_tag_manager/views/website_templates.xml @@ -0,0 +1,66 @@ + + + +