Search code examples
regexgoogle-analyticsnewsletter

Need to write a Google Analytics regex pattern for newsletter signup tracking


This is slightly beyond my ken.

I have a newsletter signup confirmation URL formed like: http://godoymedical.net/?wysija-page=1&controller=confirm&wysija-key=7b246d4fc4c91968b0529237169787df&action=subscribe&wysijap=subscriptions&wysiconf=YToyOntpOjA7czoxOiI0IjtpOjE7czoxOiIzIjt9

I need to track it with RegEx in Google Analytics. The important parts are clearly:

wysija-page=1 controller=confirm action=subscribe

When that stuff appears in an URL, I need to record it as a signup. Yeah, way over my head. Anyone here done this before?

enter image description here


Solution

  • If you want to capture everything no matter what the string might be after = then you could use:

    (wysija-page=\d+)(?:.*)(controller=\w+)(?:.*)(action=\w+)
    

    example: http://regex101.com/r/tP1fG3

    If you specifically only want page=1 controller=confirm, etc.

    (wysija-page=1)(?:&.*)(controller=confirm)(?:.*)(action=subscribe)
    

    example: http://regex101.com/r/hI3pO2