We know that Sitecore provides us with Sitecore analytics. It has great features and functionalities to offer. Further, it provides reports like page/URL tracking, item tracking, etc in the analytics dashboard. You can even do customization in it, for example, if you want to add the user journey and the custom goal, event and page view tracking in it, you can.
But what if one of the clients do not want to go with Sitecore analytics because they are familiar with Google analytics and more accustomed to it and have also chosen to continue with it? You can activate Google analytics along with Sitecore analytics. You can even add more customization from the analytics in the user journey in some of your chosen functionalities.
A Google account is a must if you want to integrate Google Analytics in your website.
So, sign up or sign in with your Google account and go to this link tps://analytics.google.com for integrating the Google analytics. You also need to create an account for your site. For that click on “Start measuring” and you will get the page as shown below.
In the account name field, please insert your account name and then select the checkboxes according to your website. Press next after that.
In the next step, you will have to create property name. The property name could be anything like your domain name or organization name but it has to be more specific if you are going to assign a domain name Demo.com then the property name should be demo.
After that is done, you need to select the time zone that you are comfortable with in tracking the activities as per your timing. Similarly, you also need to select the currency that you use so that it will show you the revenue and other monetary details into the analytics in your preferred currency.
Once you are done with that, click on Next and we are at the final stage. In this, you have to provide your business information and provide the data according to your business. After this, click on create.
Once you click on the “Create” button, you will get to confirm the T&C required for using that functionality. If you agree, you can click “i agree” and if you don’t then it will not allow you to create analytics.
Once you have accepted the terms and conditions, your account will be created and your screen will look like it is shown in the screenshot below.
Still, if the analytics are not bound to your site or the product then you need to set it up to your site. For that, you have to click on the product for which you want to integrate analytics. In your case, you want to integrate the website so you will simply click on Web. Your screen will look what is shown in the image below.
Now that you have completed the steps as we have mentioned so far, you just need to provide your domain name and the stream name and from Measuring, you will get the events measuring setting which you can keep if you need or else you can turn it off. We suggest you keep it on.
Next, create the stream by clicking on “Create Stream” and once it is created, you will get the below screen in which you will find the unique stream ID as well as the measurement ID.
At the final stage you will need to insert the script to your website so that Google can track the activities that are happening on your website and send it over to analytics. In order to do that, you can go to the View tag instruction from the same page.
Once you click on the view tag instruction, you will get two options as it is mentioned in the below screenshot.
If your site is made from an online platform like mentioned above, you will have to select your platform or else you can simply go for installing it manually and it will provide you with the required script for setting into your webpages.
Once you add this script to your pages, you will start receiving the tracking events in your analytics.
Is it possible to send the custom fields?
Yes of course google analytics is providing custom field implementation by google analytics dataLayer Event
To integrate it, you will need to follow these steps first from the tag manager https://developers.google.com/tag-platform/tag-manager/web
My requirement is to bind the custom like logged in user Id so I just send the dataLayer to the analytics eg.
dataLayer.push({“user”: “Joel”, “userID”: “s12237998”})