updated onpage js snippet.