简体   繁体   中英

Google Tag Manager and Google Analytics tracking

I have configured GTM and GA on my website. I installed GTM Assitant (chrome extension) to try and it works perfectly.

When I check GA Real Time event, my GTM is returned.

My question is : Someone know if I can track click count by week, month, year like page view ?

Thanks.

EDIT :

<div class="phone">
    <a href="#" onclick="gaEvent()" title="voir notre numéro de téléphone">
        <span class="infosPhone">Assistances</span>
    </a>
</div>

<script>
    gaEvent() {
        gtag('event', 'phone_track_click', {
            'event_category': 'click',
            'event_label': 'Clique téléphone'
        });
    }
</script>

When the user click, phone number is displayed.

To see how many events over a period of time, you will use the "Behavior > Events" reports. Click on the "Top Events" report:

在此处输入图片说明

In your case, the event your tracking has the following structure:

Category: click Action: phone_track_click Label: Clique téléphone

So in the "Top Events" Report, under the "Event Category" column click on the "Click" category, example: 在此处输入图片说明

Once you've clicked on the "click" category, you should be presented with a list of actions within that category, click on the "phone_track_click" action 在此处输入图片说明

Once you've go into that event action, you will be presented with the labels. Do the same thing and click on the "Clique téléphone" label and you should be presented with something similar to:

在此处输入图片说明

You can adjust your date range and see the total for that period (say a year) under "Total Events" and "Unique Events".

You can adjust the graph to show by "day", "week", or "month" on the top right. Hover over the data points to get the value.

Yes you can, you would have to use Google Analytics Event Tracking.

Google tracks click on button and display result in format which you desire with many other additional features.

Implementation : On click you would have to call this script code provided by google

gtag('event', <action>, {
  'event_category': <category>,
  'event_label': <label>,
  'value': <value>
});

You can update this code according to your needs

<action>, <category>, <label>, <value> // these values should be replaced according to your needs.

Sample Code

<button onclick="gaEvent()"> Click Me <button>

<script>
gaEvent() {
  gtag('event', 'track_button_click', {
    'event_category': 'click',
    'event_label': 'My button click'
  });
}
</script>

NOTE: Add this in header of page where you want to track events update GA_TRACKING_ID with your ID.

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
</script>

All this can be referred from official documentation https://developers.google.com/analytics/devguides/collection/gtagjs/events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM