_gas.push

Extended Google Analytics measuremet.

_gas.push

Description

_gas.push( Array ) : void

Method _gas.push, also as a native Google Analytics method_gaq.push, is used for passing parameter to Google Analytics script.

Parameters

Array

A pushed array has the same shape as array pushed to native _gaq.push method. List of all methods can be found in Google Analytics API documentation. The difference with the native method is that it can be pushed method without a tracker name - and this way is recommended.

Pushing without tracker name

Parameters passed to push method are forwarded to all created trackers. This eliminates a duplication of code when it is needed to measure to multiple accounts. For example, when it is measured into one profile, an event is recorded on page and when is needed to duplicate measurement to another profile, you just add a simple line - the one with the creation of a tracker.

<script type="text/javascript" src="/analytics.js"></script>
    <script type="text/javascript">
    _gas.setDomainName('.ga-script.org');
    _gas.create(['UA-12345-1', 't1']);
    _gas.create(['UA-12345-2', 't2']);
    _ga.push(['_trackEvent', 'YouTube', 'GA Script video', 'Player started']); // is tracked in t1 and also in t2
</script>

This syntax greatly simplifies adding and removing profiles, which is tracked into.

For compare there is an equivalent code in standard Google Analytics syntax.

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['t1._setAccount', 'UA-12345-1']);
    _gaq.push(['t1._trackPageview']);
    
    _gaq.push(['t2._setAccount', 'UA-12345-2']);
    _gaq.push(['t2._trackPageview']);

    _gaq.push(['t1._trackEvent', 'YouTube', 'GA Script video', 'Player started']);
    _gaq.push(['t2._trackEvent', 'YouTube', 'GA Script video', 'Player started']);
</script>
Pushing with tracker name

Used to push parameters to one concrete tracker. For example:

<script type="text/javascript" src="/analytics.js"></script>
    <script type="text/javascript">
    _gas.setDomainName('.ga-script.org');
    _gas.create(['UA-12345-1', 't1']);
    _gas.create(['UA-12345-2', 't2']);
    _gas.push(['t1._trackEvent', 'YouTube', 'GA Script video', 'Player started']);  // event is tracked only in t1
</script>

Return Values

Nothing

Examples

See above.