Improve checking for existing IDs

Rearranges the track_pageview function so it checks for an existing id
parameter dynamically, instead of trying to sort through the string
manually.