google tag manager (manual in english)
Embed Size (px)
DESCRIPTION
TRANSCRIPT
, which opens website content) and then all other codes are added to website through the container with no need of interference in a websites source code. Remember! The container should be installed on each subpage of our service. As, for example, Analytics code. It is so important that in the case of omitting any subpage there is no possibility to add tags with GTM on it. Thats why we will not be able, for example, to use Analytics code on it, if we want to install a tracking code with GTM. What are tags? Tags are tracking codes which we want to paste on a website with the GTM tool. The Tag is a script, e.g. Google Analytics that we paste usually in the websites code. It can be also AdWords conversion tag, remarketing tag or other marketing tool tag which require adding some fragment of the code on our website. What are rules? Rules are nothing else than principles when a given tag is to be fired in the container. For example, if we added a tag of AdWords conversion tracking, we would not like to fire this code on each subpage of the service but only on the website which confirms doing a desired action by visitor purchase, e-book download, filling in a form, etc. Such a website can be determined as a last website in some process to aim, on which it is information confirming this action, for example Thank you for purchase. Its URL address can look i.e. www.my-website.pl/thankyou.html To count a conversion in AdWords, when someone achieves the end of conversion path and 11 sees the above website, we must create a rule in GTM which will define a condition of firing the conversion code. The condition (rule) could say as follows: Fire the Adwords conversion code when there is a word thank you in URL address. In other case the code will not be fired and the conversion will not be counted. What are macros? A definition: Macros are the pairs "name-value" whose value is completed in the course of action. For example, an initially defined macro named URL is defined in this way that its value of actual URL of the website. This is a definition. Because macros are a bit more complicated elements we will deal with them a little later by the way of more advanced use of GTM. They are not required for simple standard installations but we rather cannot ignore its importance. Summary So, how can all these elements be easily summarized while explaining their relationships between them? Tags are codes which we want to place on the website (e.g. Google Analytics code), rules are used for defining when a given tag is to be fired (e.g. GA code is to be fired on all pages), while macros are used for automating and simplifying work with data which are necessary for tag and rule working on our website. 12 Google Tag Manager on the website Google Tag manager can be used in the case of most codes which we have to add to our website to benefit from such mechanisms like statistics of website views, conversion tracking or other data needed for marketing actions. In the following steps we will move to the process of correct installation of GTM on the website by implementing the most popular tags. Meanwhile, we will explain all functions and concepts, which may not be clear in official GTM help. Google Tag Manager installation step by step Google Tag Manager installation is very simple and includes few steps. They are: creating an account, creating a container, settings configuration and installation of first tags i.e. tracking codes. Although the first actions are quite simple, the questions will arise just surely at the beginning of actions. I will try to foresee them here and explain ;). Step 1 Create a GTM account This action is very simple. You need only to enter https://www.google.com/tagmanager/ and create an account. First container What a container is we have explained at the beginning of this e-book. Now it is time for its creation and installation. 13 A good practice is just to name a container as we have named our account but it is not obligatory. Perhaps we will have soon several containers, so it is important to create the terminology system. The subject of terminology is essential because our account with time will be bigger as we will add next tags, macros and rules. We will have to know what they are used for. Then we have to choose where we want to use our container, on a website or in the mobile application. It is also one of the advantages of GTM that we can use it to administer tags, and even administer changes in mobile applications. We will write more about it later. If I have a lot of domains, subdomains, so how many containers do I need? How many containers should I create? It was my first question, which came to my mind while creating the first GTM account. Generally, if I have a lot of domains but they are not connected with one another, it is a good practice to keep the principle one domain one account - one container. It allows keeping an order while it does not disturb to administer them because we can administer a 14 lot of GTM accounts from the level of one login and password. It is seen on the image below where with one login I have an access to many GTM accounts. Lets come back to the installation of the first container. Because actually we implement GTM on the website, we choose an option of a container just for the website. If we implement tag manager in application, we will choose a suitable version of mobile applications. When choosing a version for a website an available container will occur to be pasted on our website. 15 We copy a ready code of the first container as a whole and paste it on our website. The best place to paste a container code is a place directly below the tag which opens the website content - . We will find it easily in the website code by the option search in content. We can see how it looks like for a sample website by clicking the right mouse button on the website content and choosing Show the website source. 16 What if we cannot put the GTM code in the place described above? Remember that the best place for a container, which guarantees the best data collecting, is the place directly below the tag. Unfortunately, there is no guarantee that our codes implemented by GTM will be called correctly if we change the place of the container. Especially I do not recommend pasting the container code in the section because the script includes iframe which can cause an unexpected action of the browser. Step 2 Create the first tag As we have seen in the image from p. 13, after creating the first container we can see, at once, several built-in tags at our disposal ready to be installed on our website. As you can see the most popular Google tags are there, we have also available Doubleclick tags. There are also several tags of other companies available in GTM. In addition, there are custom tags (Custom HTML) thanks to which we can actually place every other tag on our website, even if it is not normally on the standard GTMs tag list. We will discuss implementation of the most popular tags in details in a moment. Now we will stop for a while and discuss settings and functionality of the account, which we will use in a while. Settings and functionality of the GTM account While creating the GTM account and the first container we have one user (i.e. ourselves). In GTM account we can add next containers and users. As we can see below we can use the New button and add a user or a container. 17 According to what I have written before, a good practice is to keep a rule one account, one domain, one container. However, we can ignore this principle in different cases. Many domains we treat as the whole. Then we can use one container for many domains because rules, tags and macros cannot be divided between containers. If all domains are to be configured in a similar way, the use of one container is applied. Many tags on one domain. If we have plenty of tags to handle, it is much easier to administer them if we divide them into two containers or more. It gives us bigger clarity what and when is to be fired and it makes also that the container itself is less loaded (it is smaller). It is possible to e.g. segregate tags according to a type and a tool. However it is quite rare. 18 Many users with different access rights Access rights for users can be granted on the container level. Thus, if we want to limit the access to other domain or tag configuration we have to use more containers and give the next users access and rights on their level. We can grant accesses of different rights: browsing, browsing and editing or browsing, editing and publishing (full access) Test environment A good idea is to use different containers while testing implementation of new tags or rules. Especially for big services, a wrong configuration and loss of data for some period can be painful. Hence, it is worth paying attention to it during implementation. At the moment of implementation it is a good idea to make use, especially in Google Analytics and other statistics issues, of the Lookup Table macro, which we will discuss later in this e-book. At the very end you can find a proposed migration plan to Google Tag Manager. "Settings" tab In the "settings tab there is an identifier of a container and a container name, which we can change in any time. "Containers" tab In the "Containers" tab we can see currently created containers on the account, number of tags created for a given container, our rights to edit a container and a number of users assigned to it. Choosing our existing container, which is called "my test container in our example, we proceed to the heart of Tag Manager itself i.e. to container settings. 19 As we can see in the menu on the left, there are tabs concerning tags, rules and macros. We have said about these elements before and we will talk about them many times further. We will be using the left menu very often. In the center, we have a view of tags, rules and macros created by us under grey tabs. Now the most important thing, at this point, is to understand the matter of a version and a container type. So, what is all about? Adding a tag or a rule to the container or editing anything in GTM we will not see changes on our website. Nothing will be changed. To do this we have to publish the changes. Thus, in item 3 in the image above we can see a container as unpublished. To publish it and introduce the changes which will have reflection on our website first we have to create another version of a container (item 2). Then we can publish the current version. It will then go live. Any created version can be seen below the menu on the left. You can come back to the version, if there is such a need. Thanks to versions we do not override changes irretrievably. 20 In the image from website 17 you can see the item 1, that is a function of preview. The Preview function is one of functionalities used very frequently while adding or editing tags or changing other settings. Thanks to the Preview function we can preview if changes introduced by us work properly on the website. There are three options of preview of changes available. Preview It allows us to preview the website with changes applied by us. It means that after choosing a "Preview option we can enter our website, refresh it and check if changes introduced by us work e.g. in the programmers' console in Chrome browser or in Firebug tool in Firefox. Because we have not created a version in GTM yet, changes on the website are seen only by us. After switching off the preview option (a yellow bar at top of the screen), changes will stop working on the website. 21 Debug the option probably the most frequently used. It allows to add to Preview option an auxiliary console which will show us if and what tags will work on our website after creating a new version. 22 Share A "Share option allows us to create a unique url address, which we can send to a person who is not related to our GTM account. Thanks to this address the person who will use a link given by us will be able to see also working changes, which are not published yet in GTM. Installation of basic scripts on the website We now know the basic settings of Google Tag Manager. We can move to the installation of tracking scripts on our website with GTM. We will start from the most standard tags (scripts) and then we will go into more advanced ways of using this tool. Installation of Google Analytics statistics with GTM Using Tag Manager (GTM) to track traffic on the website with Google Analytics is one of most frequent cases. The simplest installation is not complicated but more advanced aspects of tracking like e.g. event tracking may cause some problems. Thus, we will deal also with these more advanced aspects in further steps. Now we will make a standard installation. In the previous part of this e-book we have created the GTM account and the first container as well. Just after creating the container we have an opportunity to move at once to create the first of the most popular tags. 23 We can start to create them at once or do this after installing the container. We have to do the following: 1. Create Google Analytics tag 2. Define rules for tag to be fired 3. Test a newly created tag 4. Create a version of the container 5. Publish Lets start from the beginning. Ad 1. Create Google Analytics tag We start creating a tag from giving the name to it. It is important because when there are many tags it will be easier to administer them if tags have properly matched names. A good practice is to construct names based on a type of a tool e.g. Google Analytics and a 24 function, which a given tag is to fulfill. The first tag which we will create is the tag named GA (Google Analytics) Pageviews, because this tag will be responsible for tracking displays of our website, that is a basic function of Google Analytics. All other functions of GA will be also used but we will use next tags to it. We will talk about it, for example, by the way of event tracking on the website with GTM. Another step is to choose the kind of a tag from the list of standard tags serviced by GTM. We choose Google Analytics from a pull-down menu. Now we can choose from Classic GA and a new version that is Universal Analytics. For the need of this example we will use a classic version. The choice of the second one will not have any influence on the way of creating and administering the GA tag, so we can choose the version at will. 25 As you can see above we have many more standard tags available, which we can use with GTM. If our tag is not on the list we can implement it with custom tags. We will talk about it later. In the next step we have to give an ID number of our account in Google Analytics, which we are going to install with GTM. We can find ID in our Analytics account. ***OFF TOPIC*** As you can see in the image above, on the right next to the ID number of the account introduced in the "Web property ID column there is a grey "Lego brick. This brick" indicates the possibility of using macros. I have mentioned before that macros are used to simplify and automate the work. We will make use of a macro for the first time to simplify using the ID number of the GA account in next cases of using this number ID on our account. 26 What to do then? 1. Mark the ID number and copy it to the storage (ctrl + C) 2. Click on the "brick and choose "New macro at the bottom. 3. Add the macro name that we know what this macro is used for, choose the type as "Constant String and a value as an ID of our Google Analytics account. There are many macro types and with time we will make use of different than Constant String. Now we are not dealing with it. After that we can use a given macro and thanks to this we do not need to remember the ID of Google Analytics account with the next tags which are to be installed. 27 It is one of the simplest methods of using macros but thanks to this we will not make mistake while pasting codes and what is more, we do not waste the time for checking a given ID many times. I will emphasize once more that Analytics tag has its types, which are responsible for different types of tracked data. So, if we want to track events and ecommerce transactions by GTM, we will have to use three tags: for pageviews (standard), for events and for transactions. We need to give the ID number of the GA account each time we create a tag for given GA account. Thanks to the created macro we do not have to remember ID of account. So we used macro for the first time. It is simple way but very useful and we will use it, in this way, quite often. ***OFF TOPIC*** Let's come back to creating our Tag. After choosing a type of the tag as Google Analytics, we can see the option Enable Display Advertising Features below. This option is used for switching on possibilities to make use of remarketing in Google Analytics and demographic reports. In practice this option adds to the code a Doubleclick cookie, which is just responsible for these additional possibilities of Google Analytics. 28 Track type I have mentioned about track types a little earlier by the way of creating the first macro. There can be many track types depending on a kind of a tag. Even in the case of Google Analytics we have them quite a lot. Website View tracking is of course a standard type but in the further part we will use next types, just as we will want to start the following functionalities of Google Analytics with GTM, such as, for example, event tracking on the website or traffic tracking between domains. We will talk about it further on. The first rule in GTM At this moment we have just almost configured the first tag. The only thing which is left before testing and publishing it is to add a rule which will allow us to set the rules when 29 GTM has to fire a given tag. Rules are set in interface in the right upper corner. To be fired each newly created tag will need a rule. It will not work without the rule. What we have to do is to wonder now when a given tag is to be fired. Our first Google Analytics tag is to be fired on each subpage of our service. It is quite obvious because we want to collect data about all pageviews on our. Then we have to set the rule which will fire a tag on each website of the service. When we want to add a new rule a window of its choice will occur. We can choose rules that already exist and which we have created earlier for other tags from the list or create a new one. In the case of new accounts and containers we have to create rules from the beginning. As you can see, a rule, which we are interested in, is already available in standard fire it on each subpage. You have to only mark it, and it is ready. In the case of creating new rules we have to create a rule about conditions, which have to be satisfied so that a given tag could be fired. We will deal with creating more advanced rules later in this e-book by the way of creating a tag for tracking AdWords conversion where we will describe creating of rules more extensively. 30 Testing a newly created tag We have created the first Tag. Before we publish it on the website it is worth testing and seeing if it works. As you can see below, our version of the tag is unpublished. It means that changes introduced by us did not come into effect. It is always worth paying attention to it because it is one of more frequent mistakes which are made by not only beginners. If we do not publish changes (a new container version) we will not see them live. They could be seen only in Preview Debug. However, before we publish anything we have to verify it. We choose the Preview option and then Debug option (see p.17). Lets move to our website in a new tab of a browser and refresh the view. Thanks to this a console will occur at the bottom of the screen with information if our tag is fired under conditions defined by rules. 31 You can see in the console that our tag has been fired. Everything works. Now we can come back to the tab with opened Tag Manager and publish the version. To do this we create a new version and publish it. A new version is created now (in our case version no. 4). Pay attention to a yellow bar at the top with a message about the preview on our website. If we now go to the website we will see all the time the console at the bottom of our website. Thus, if we finish the work we can quit this mode (For clarity, a preview mode is seen only by 32 us, other users cannot see it. They could see it if we would sent them a special link to the preview, which I have written about before). Next steps Our first tag has been published. Now, we are ready to install next tags which will be needed to track our advertising actions and not only. However, before we move to the next tags, we should mention about a very useful tool which will allow us to see if our website, or any other, has installed and working tags. This tool is Tag Assistant. It is a simple and friendly plug-in to Chrome browser. Thanks to Tag Assistant we can easily verify what tags are working on the website being viewed by us. We will get guidelines and suggestions concerning tag implementation. Tag Assistant is a tool, which is, we can say, obligatory. Assistant can be downloaded free from Google Chrome shop. 33 Installation of Google AdWords conversion tracking with GTM In the previous chapter we managed to create the first tag, which is used for tracking displays with Google Analytics. We have created the account, the container, then the tag where we have chosen its type (Google Analytics) and defined when our tag has to be fired (rule). In this step we will create a tag, which will service AdWords conversion tracking. AdWords or other conversion tracking What do we actually need for conversion tracking? We need to measure traffic on the website or a number of actions which will confirm that the conversion took place. For example, a classical example of a conversion are displays of the website Thank you for purchase, contact, etc. That is the website which is displayed only when a user did some action desirable by us, for example, filling in the form. A classical conversion path seems to look more or less like this: Main website -> category website -> product website -> form -> payment ->thank you. To track the conversion we need to track the last website - Thank you with the special code called the conversion tracking code. During visits from AdWords ads, the code is compared to a cookie, which was granted to users at the moment of clicking on the advert. If data from the cookie matches data from the tracking code, a conversion is counted. It is a description of working in short, but it is only to remind it and to eliminate the mental shortcuts of the author. To track conversions we need an address of the "Thank you website and we have to place a suitable conversion code on this website. So far, it has been as follows: 34 1. We have generated a conversion code in AdWords account 2. We have copied the code. 3. We have edited the "Thank you website 4. We have pasted the conversion code in the code somewhere at the end of the website just before the closing