segment-boneyard / analytics-magento

[DEPRECATED] The hassle-free way to integrate analytics into any Magento store.
15 stars 19 forks source link

Ensure Context JSON outputs current version #53

Closed astorm closed 10 years ago

astorm commented 10 years ago

Looks like the version number (0.0.1) is out of date? Would be good if we injected this from a single source place so that we only have to update in one spot.

astorm commented 10 years ago

We fixed this in a previous commit. We output this in the context JSON, and read directly from the Magneto module version number. The context JSON is generated here.

public function getContextJson()
{
    $renderer = $this->getLayout()->createBlock('segment_analytics/json')
    ->setData(array(
        'library'=> array(
            'name'=>'analytics-magento',
            'version'=>(string) Mage::getConfig()->getNode()->modules->Segment_Analytics->version
    )));       
    return $renderer->toJsonString();
}

Specifically, we're grabbing the version with

Mage::getConfig()->getNode()->modules->Segment_Analytics->version