All Collections
How-to
Install correctly gtag.js or Google Tag Manager on a DragDropr page.
Install correctly gtag.js or Google Tag Manager on a DragDropr page.
Aleks avatar
Written by Aleks
Updated over a week ago

No matter if you want to use the Google gtag or the Google Tag Manager:

  1. Open your DragDropr page, click on “Page Settings” and go to “Add Scripts” menu.

gtag.js

Put the gtag.js Script which you find in your Analytics account (Settings > Property > Tracking-Information > Tracking Code) in the head section.

Important: remove the comment line (<!-- Global site tag (gtag.js) - Google Analytics --> ) or the gtag will not work properly as any script added to DragDropr has to start with <script> and finish with </script>.

Click on SAVE, then on PUBLISH and choose your preferred option.

Google Tag Manager

  1. Copy the GTM code you can find in your Google Tag Manager account (Admin > Install Google Tag Manager)

2. Put the <script> part in the head section. Leave out the comments (<!-- Google Tag Manager -->  and <!-- End Google Tag Manager --> ) so that <script> is at the beginning and</script> is at the end. 

3. Put the <noscript> part in the body start section. Again, leave out the comments so that everything starts with <noscript> and finishes with </noscript>. 

Click on SAVE, then click on PUBLISH and choose your preferred option.

Bonus: What’s the <noscript> part of GTM doing? 

The <script> part of GTM is the foundation of the Google Tag Manager. The higher you place it in your code, the sooner it will load, therefore your tracking and marketing tags will capture data sooner. As a result, your data will be more accurate. So basically, JavaScript does all the heavy lifting in Google Tag Manager. 

But what if Javascript is turned off or does not work? Now that is where <noscript> enters the game, because it only functions when JavaScript is disabled.

So when JavaScript is turned off and a page is loaded, the <noscript> initiates an iFrame. An iFrame is an inline frame used inside a webpage to load another HTML document inside it (e.g. a webpage within a webpage).

A <noscript> always has to be placed in the <body> section of a page or not be placed on a page at all. Since <noscript> initiates an iFrame and iFrame is not supported in the <head>, your website’s code will become invalid.

Most of the functions of GTM do not work with <noscript>. In fact, only some of the most prominent built-in-variables like Page Hostname, Page Path, Page URL will work. You can find a full list of supported built-in and user-defined variables at Analyticsmania

So if you are not interested in tracking of visitors with JavaScript disabled or website verification in Google Search Console via Google Tag Manager, you don’t need to implement the <noscript> part of GTM at all. 

Did this answer your question?