added analytics snippet func