Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Подключение файла .json


Recommended Posts

Всем привет.

Подскажите, надо подгрузить файл .json

В начале страницы header.tpl

Какой код надо прописать в блоке <head></head>

Заранее всем спасибо.

Link to post
Share on other sites

В общем суть задания такая подключил GTM.

Включил кэш браузера но PageSpeed Tool ругался на вот это:

https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX (15 минут)

https://mc.yandex.ru/metrika/watch.js (60 минут)
https://www.google-analytics.com/analytics.js (2 часа)

 

Я решил это пофиксить:

Скачал файлы watch.js и analytics.js положил их в папку сайта на сервер.

Зашел в GTM прописал теги при помощи HTLM на загрузку этих файлов локально с моего сервера.

 

Теперь мой сайт на тесте PageSpeed Tool пишет только это:

https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX (15 минут)

 

Я зашел на сайт GTM экспортировал контейнер в файл .json

Кинул в папку на сервер.

Теперь мне его надо как то подгрузить в начале страницы.

Код там вот такой:

{
    "exportFormatVersion": 2,
    "exportTime": "2017-09-20 18:43:35",
    "containerVersion": {
        "path": "accounts/1803967156/containers/7546917/versions/3",
        "accountId": "1803967156",
        "containerId": "7546917",
        "containerVersionId": "3",
        "container": {
            "path": "accounts/1803967156/containers/7546917",
            "accountId": "1803967156",
            "containerId": "7546917",
            "name": "mismartstore.ru",
            "publicId": "GTM-XXXXXX",
            "usageContext": [
                "WEB"
            ],
            "fingerprint": "1505929770811",
            "tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/1803967156/containers/7546917/workspaces?apiLink=container"
        },
        "tag": [
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "tagId": "1",
                "name": "Google Analytics",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<script>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n  })(window,document,'script','http://mismartstore.ru/metrika/analytics.js','ga');\n\n  ga('create', 'UA-106417305-1', 'auto');\n  ga('send', 'pageview');\n\n</script>"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1505930673829",
                "firingTriggerId": [
                    "2147479553"
                ],
                "tagFiringOption": "ONCE_PER_EVENT"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "tagId": "2",
                "name": "Yandex Metrika",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<!-- Yandex.Metrika counter -->\n<script type=\"text/javascript\" >\n    (function (d, w, c) {\n        (w[c] = w[c] || []).push(function() {\n            try {\n                w.yaCounter45944430 = new Ya.Metrika({\n                    id:45944430,\n                    clickmap:true,\n                    trackLinks:true,\n                    accurateTrackBounce:true,\n                    webvisor:true, \n                    ecommerce:\"dataLayer\"\n                });\n            } catch(e) { }\n        });\n\n        var n = d.getElementsByTagName(\"script\")[0],\n            s = d.createElement(\"script\"),\n            f = function () { n.parentNode.insertBefore(s, n); };\n        s.type = \"text/javascript\";\n        s.async = true;\n        s.src = \"https://http://mismartstore.ru/metrika/watch.js\";\n\n        if (w.opera == \"[object Opera]\") {\n            d.addEventListener(\"DOMContentLoaded\", f, false);\n        } else { f(); }\n    })(document, window, \"yandex_metrika_callbacks\");\n</script>\n<noscript><div><img src=\"https://mc.yandex.ru/watch/45944430\" style=\"position:absolute; left:-9999px;\" alt=\"\" /></div></noscript>\n<!-- /Yandex.Metrika counter -->"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1505929653844",
                "firingTriggerId": [
                    "2147479553"
                ],
                "tagFiringOption": "ONCE_PER_EVENT"
            }
        ],
        "builtInVariable": [
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "PAGE_URL",
                "name": "Page URL"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "PAGE_HOSTNAME",
                "name": "Page Hostname"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "PAGE_PATH",
                "name": "Page Path"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "REFERRER",
                "name": "Referrer"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "EVENT",
                "name": "Event"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_ELEMENT",
                "name": "Click Element"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_CLASSES",
                "name": "Click Classes"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_ID",
                "name": "Click ID"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_TARGET",
                "name": "Click Target"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_URL",
                "name": "Click URL"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CLICK_TEXT",
                "name": "Click Text"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_ELEMENT",
                "name": "Form Element"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_CLASSES",
                "name": "Form Classes"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_ID",
                "name": "Form ID"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_TARGET",
                "name": "Form Target"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_URL",
                "name": "Form URL"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "FORM_TEXT",
                "name": "Form Text"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "NEW_HISTORY_FRAGMENT",
                "name": "New History Fragment"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "OLD_HISTORY_FRAGMENT",
                "name": "Old History Fragment"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "NEW_HISTORY_STATE",
                "name": "New History State"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "OLD_HISTORY_STATE",
                "name": "Old History State"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "HISTORY_SOURCE",
                "name": "History Source"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CONTAINER_VERSION",
                "name": "Container Version"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "RANDOM_NUMBER",
                "name": "Random Number"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "CONTAINER_ID",
                "name": "Container ID"
            },
            {
                "accountId": "1803967156",
                "containerId": "7546917",
                "type": "HTML_ID",
                "name": "HTML ID"
            }
        ],
        "fingerprint": "1505930684514",
        "tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/1803967156/containers/7546917/versions/3?apiLink=version"
    }
}

 

Edited by AlexeyNikiforov
Link to post
Share on other sites

Вы сейчас серьезно? Забейте на  PageSpeed Tool, такие вещи как аналитика, GTM нужно подключать такими ссылками как они есть

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.