This question has been flagged
2 Replies
7526 Views

I'm using Odoo Online and i can't use a third party app to implement the google tag manager. 


I tried to do it myself by putting the code in the header and in the body of the Web_layout. I also changed the "&" to "&" but, unfortunately i got four error messages (see below).  


Has anyone experienced the same error messages ? and how were you able to solve it ? 


Thank you, 


Error 1 : 

Traceback:

TypeError: Cannot read property 'user_context' of undefined

    at Object.loadAsset (https://www.lavitrinelocale.be/web/static/src/js/core/ajax.js:447:50)

    at https://www.lavitrinelocale.be/web/static/src/js/core/ajax.js:544:25

    at https://www.lavitrinelocale.be/web/static/src/js/core/ajax.js:555:28

    at https://www.lavitrinelocale.be/web/static/src/js/core/concurrency.js:195:30


Error2 : 

Error:

Uncaught TypeError: odoo.define is not a function


https://www.lavitrinelocale.be/:1307

Traceback:

TypeError: odoo.define is not a function

    at https://www.lavitrinelocale.be/:1307:26


Error3 :

Error:

Uncaught TypeError: Cannot read property 'services' of undefined


https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3827

Traceback:

TypeError: Cannot read property 'services' of undefined

    at HTMLDocument.<anonymous> (https://www.lavitrinelocale.be/saas_website/static/src/js/db_activation_reminder.js:7:26)

    at mightThrow (https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3534:29)

    at process (https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3602:12)


Error4 :

Error:

Uncaught TypeError: odoo.define is not a function


https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3827

Traceback:

TypeError: odoo.define is not a function

    at HTMLDocument.<anonymous> (https://www.lavitrinelocale.be/saas_trial/static/js/activation.js:6:6)

    at mightThrow (https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3534:29)

    at process (https://www.lavitrinelocale.be/web/static/lib/jquery/jquery.js:3602:12)

Avatar
Discard
Best Answer

Hello Pierre,

I got the same traceback once. You need to insert your GTM script at the end of the head, and the noscript part right after the body.

It will resolve your traceback!


Avatar
Discard
Best Answer

Hello everybody, 

Our DB is on SaaS (not on Odoo.sh) so we are not able to install 3rd party addons to easily manage the Google tag integration. 

I am willing to follow-up steps given on Google Tag Manager's site but I am stuck at this step and I am getting the following error message from Odoo. I do not understand what it means and how to correct it in order to implement the code.

This page contains the following errors:

error on line 18 at column 51: EntityRef: expecting ';'

Below is a rendering of the page up to the first error.


Thank you in advance for the help !!


Avatar
Discard

Sorry for the late reply. The traceback you got is because Odoo is using XML as scripting template. You need to escape the special the character before saving it. Therefore, for your case, you need to escape the '&' character into '&amp;'.

For your case, in line 18, it should be
```
j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=
```