<?php
Yii::app()->hooks->addAction('before_view_file_content', function($collection){
if ($collection->controller->id != 'price_plans' || $collection->controller->action->id != 'index') {
return;
}
if (!Yii::app()->notify->hasSuccess) {
return;
}
// customer just bought a plan
?>
<script>...</script>
<?php
});