SOLVED

Track page tag

Go to solution
Highlighted
Anonymous
Not applicable

Track page tag

Hi,

I would like to understand if Munchkin can track page tags? I want to put two standard tags on all the pages, say Tag_Product and  Tag_Solution, would like to add leads to appropriate lists based on their page visit history. Example, if a leads visits a page with Tag_Product = "Network", i would add them to network list, or they visit a page tagged with Tag_Product = "Sever" I will add them to server list.

Is there any out of box, or any other recommended solution/alternatives?

Thanks for reading and your help! I will be compiling and sharing the answers for the benefit of the forum.

Deepak

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Track page tag

I mean literally all the JS I posted goes inside

success: function(){

}

Honestly the fact that you're loading Munchkin asynchronously is making it harder for you to customize the code because you're not a JS guy. You'd be better off using the regular embed code and putting it at the bottom of your HTML.  I'm not always a fan of loading Munchkin.js async because the very thing that makes async attractive -- doesn't interfere with other assets or page rendering/navigation -- is also leaving room for Munchkin to fail to register a page view before the user navigates away from the page. Of course in most cases it's beneficial, but in specific edge cases you might lose a log entry because the page has been told not to wait for Munchkin.js before moving on.

View solution in original post

22 REPLIES 22
Highlighted

Re: Track page tag

Hi Deepak,

I'm assuming by tags, you mean parameters at the end of your URL? Something like http://www.google.com?Tag_Product=Network&Tag_Solution=StuffIn that case, you can simply use a "Visited Web Page" filters with the Querystring constraint (say, contains Tag_Product=Network) and then have a flow step to add them to a static list (or, alternately, just make a smart list that does it all in one go.)

Highlighted
Anonymous
Not applicable

Re: Track page tag

Hi Courtney, thanks for responding. Indeed I want to track the HTML mega tags, that will be put under the HTML code. It will not reflect on the URL.

Deepak

Highlighted

Re: Track page tag

Ahhh, I see now.

In terms of the meta tags, the big issue is going to be if there's any categorical structure that notes something is part of a meta tag; Marketo doesn't really do a good job parsing existing data.

One solution you could consider is to do a quick JavaScript call with this using faux URLs; let's say, for instance, you have

<meta name="product" property="text" content="This is a product" />

As a meta tag in the header of your page. You could do something akin to

<script src='http://munchkin.marketo.net/munchkin.js' type='text/javascript'></script>
<script>
Munchkin.init('###-###-###');
   var x = document.getElementsByTagName("META");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
    if (x[i].name=="product")
    {
        Munchkin.munchkinFunction('visitWebPage', { url: '/meta-tag/product'});
     }
  
}   
</script>

Where you would have Marketo record a fake URL when someone visits a page with the meta name of product. This code would obviously need to be tweaked to the parameters you're using, but it'll at least generate something in Marketo to generate lists with.

Highlighted
Anonymous
Not applicable

Re: Track page tag

Thank you Courtney. I am trying this solution, will let you know the outcome.

Thanks

Deepak

Highlighted
Level 10 - Community Moderator

Re: Track page tag

Hey Courtney, check this one out: CodePen - Meta to Query String.  I was going to post it yesterday but didn't because of browser compat (triggers a reload in IE8 and IE9, magical everywhere else).

Highlighted

Re: Track page tag

That's definitely cleaner than the way I did it! That being said, thanks for the heads-up on Munchkin::init(); I've seen the duplication happen a couple of times in the past but chalked it up to other things.

Highlighted
Level 6 - Champion Alumni

Re: Track page tag

Sanford Whiteman​ the link you provided displays a blank page for me.  Is there an alternative link to that content?

Highlighted
Level 10 - Community Moderator

Re: Track page tag

Sure, just substitute "pen" for the word "debug" in the URL. There isn't any body HTML on the page itself, though -- it's to demonstrate how the URL magically changes to include the META tag, but without refreshing.

Highlighted
Level 10 - Community Moderator

Re: Track page tag

If you need to add data from the document itself before logging Visited Web Page activity, I recommend adding it to the hash before you initialize Munchkin:

var productMeta=document.head.querySelector('META[name="tag_product"]');

if (productMeta) document.location.hash = "tag_product:" + productMeta.getAttribute('content');

Munchkin.init('XXX-YYY-ZZZ');

When you run Munchkin::init() you always get a Visited activity (there are obscure and undocumented ways to turn that off, but let's assume in practice you can't).  So while Courtney's suggestion of using Munchkin::visitWebPage will work, it'll always add a second Visited Web Page action.  I tend to find that cumbersome if you can avoid it. 

Of course if you are using hash-bang navigation or anything like that you'll need to deal with the hash change.  Otherwise it'll be transparent and will get the metadata tags into your Marketo db.