Guides‎ > ‎TV Analytics‎ > ‎TV Analytics Plugin‎ > ‎

TV Analytics Plugin using GTM custom event and Google Analytics Event

This is a step-by-step guide to using the TV Analytics Plugin for the Google Tag Manager without having access or otherwise unable make changes to the source code where the container is deployed.

1. Log into the Google Tag manager and select the correct workspace/container. You want to create a new tag.

2.  Give your tag a new name. It should be descriptive so you know what you are using it for.

3. Click on 'Choose a tag type to begin setup...' and select 'Custom HTML'

4. In the HTML field you will now want to include the GTM plugin code. Take special care to include the mapping parameter with the value '5' (in the screenshot mapping=5) and check you have entered the correct customer ID (in this screenshot the example customer ID is 123456) wywy has provided you with.

5.  Next you will need to select a trigger. The best thing to do is to fire the tag on all pages.

6. Save the tag and move on to the next step.

7. The tag we just set up will push the TV airing data into the dataLayer. We want to use this data, so we need to set up a variable that will get populated with the information we need. Click variables and then select new.

8. Give your variable a name. We will need this in a later step. Descriptive names are best.

9. Choose a variable type and select 'Data Layer Variable'

10. Enter 'wywyTvTracking' into the Data Layer Variable Name. This is not optional, and you cannot set this name yourself. You must enter the name of the variable exactly as seen below.

11. Save your new variable and proceed to the next step.

12. We now have a tag set up to push data to the Google Tag Manager dataLayer. We also have a variable we can use. The only thing left to do, is to make sure that the data also gets sent to Google Analytics. Create a new tag and give it a descriptive name.

13. Select a Universal Analytics tag.

14. Select an Event type tag.

15. Enter a name for your event category and event action.

16. We very strongly recommend using a non-interaction hit by setting the value to 'True'. You otherwise run the risk of affecting the way your site bounce rate is measured and reported. This event is only used as a proxy to transfer data.

17. You will now need add the Google Analytics settings.

18. We very strongly recommend creating new and alternate settings for use the the plugin.

19. Enter the Google Analytics tracking ID (in the screenshot the example tracking ID is UA-1-234567).

20. Select custom dimensions and add the index you have set up to use with wywy TV airing data. Visit our step-by-step guide for Google Analytics if you have not completed this step yet.

21. Enter the variable we set up in step 8 as the dimension value

23. Save your new settings

24. The settings should have populated.

25. Select a trigger for the tag. You will need to create a new trigger for this. 
26. Name your new trigger.

27. Select the trigger type 'Custom Event'

28. Enter the event name. 'wywyTvTracking' is the event name. You must enter this exactly as shown below.

29. Save the event.

30. Save the Google Analytics tag.

31. Check to make sure all your changes have been saved, then create a version, test and publish!