0
votes

So I was following this tutorial: https://mixedanalytics.com/blog/ga-gtm-datalayer-custom-dimensions/

    dataLayer.push({
      event: 'btnclick',
      actionType: 'play video',
      vid: this.video.id
    });
  1. I created two custom dimension inside Google Analytics, action type and vid.

  2. I set up two Google Tag Manager variables of type Data Layer Variable inside of Google Tag Manager, actionType and vid.

  3. I added a GA tag with the following:

    Track Type: Event (wrong?)

    Action: {{Event}}

    Google Analytics settings: {{Tracking ID - GA - Settings}} (wrong?)

    Custom Dimensions: 1 {{Properties - Actiontype}} 2 {{Properties - VID}}

    Triggering: Button Click (Custom Event)

  4. Added a trigger in Google Tag Manager with:

    Trigger Type: Custom Event

    Event Name: btnclick

I am not sure if the Track Type inside GA tag is correct, and I am not sure if the Google Analytics settings is correct. In the tutorial, the guy uses Page View, so I am unsure if I chose the correct settings and whether it would work. I am pushing into the dataLayer after the jQuery event listener for click is triggered.

Would this allow me to get the view count for all videos (We have about 1,000 videos)?

Also, upon setting custom dimension, we are given these instructions:

Example Codes for This Dimension
Copy the following code snippet for your platform. DO NOT FORGET to replace dimensionValue with your own.

JavaScript (gtag.js)
For instructions on how to setup custom dimensions using gtag.js, please refer to the gtag.js developer documentation.

JavaScript (Only works for Universal Analytics properties)
var dimensionValue = 'SOME_DIMENSION_VALUE';
ga('set', 'dimension1', dimensionValue);
Android SDK
String dimensionValue = "SOME_DIMENSION_VALUE";
tracker.set(Fields.customDimension(1), dimensionValue);
iOS SDK
NSString *dimensionValue = @"SOME_DIMENSION_VALUE";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];

Is this necessary, because in the tutorial the author doesn't mention anything about this.

1

1 Answers

1
votes

What's your reason for using Custom Dimensions? It sounds like you just want to capture interaction events around video on your site.

Events in GA has "Category", "Action", "Label" and "Value".

In your case, your events should be set up something like:

Category: Video

Action: Play

Label: {video id}

So your event tag should be setup similarly:

Category: Video

Action: {actionType}

Label: {video id}

Trigger: video-event

Then when you are coding for your events, push the following to the dataLayer:

{
video-id: '12345',
action-type: 'play', //pause, skip, etc whatever you want here
event: video-event
}

I don't think you need to use custom dimensions.

If you want to track video views, wouldn't each video have its own unique URL?