To push a key value pair to the dataLayer you can simply call the data method within your controller files. You can call the method as many times as you want to push values to the data layer. The key value pairs will generate the necessary data layer JavaScript code.
GTM::data('key','value')
outputs:
window.dataLayer = window.dataLayer || [];
dataLayer = [{
'key' : 'value'
}];
Events play a very important part in a lot of custom Google Tag manager tracking. You can push an event easily with the event method.
GTM::event('MyEvent')
outputs:
dataLayer = [{
'event' : 'MyEvent'
}];
Next: Pushing Ecommerce data