SOLVED

Tracking mp3 file plays on Marketo Landing Page

Go to solution
Sarah_McConnell
Level 2

Hi all,

I have an mp3 podcast file embedded on my landing page using an audio script:

audio controls>

<source src="https://go.synack.com/rs/738-OEX-476/images/Synack Podcast - Executive Lunch - RSA 2019 - Episode 1 with Intro.mp3" type="audio/mpeg">

Your browser does not support the audio element.

</audio>

I thought I would be able to track when someone plays the podcast using a link click (tracking the mp3 link) but that doesn't work. Does anyone know of anyway to track if someone clicks play on that mp3 file?

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

OK, please try this:

document.querySelector("audio").addEventListener("play",function(e){

Munchkin.munchkinFunction("clickLink",{

href : this.currentSrc || this.src

});

});

P.S. It's actually better to use synthetic Visit Web Page, not Click Link, for reasons I'll explain in an upcoming blog post, but Click Link will be okay for your case.)

View solution in original post

29 REPLIES 29
Sarah_McConnell
Level 2

I am not sure how to see that in Dev Tools....

SanfordWhiteman
Level 10 - Community Moderator

Look at the Network tab. You'll see hits to ../clickLink.

Sarah_McConnell
Level 2

Just seeing hits to the mp3 file name

Screen Shot 2019-05-02 at 4.08.58 PM.png

SanfordWhiteman
Level 10 - Community Moderator

OK, I swapped in one of my Munchkin IDs for yours (and fixed the JS syntax error) and audio tracking works as expected.

pastedImage_0.png

pastedImage_1.png

So if you fix the syntax error on your actual LP there shouldn't be any problem.

Sarah_McConnell
Level 2

I fixed the Syntax error and it still doesn't seem to be working on my end. Would love to hop on a screen share! I am free all day today. Thanks so much for all your help on this!

SanfordWhiteman
Level 10 - Community Moderator

How about right now? Message me and I'll give you my JoinMe.

Sarah_McConnell
Level 2

Message sent!

SanfordWhiteman
Level 10 - Community Moderator

Sarah, you still have a syntax error because of an extra comment:

pastedImage_1.png

After fixing that (you may want to cut the whole current <script> out, save + approve, and then go back in and re-paste the code) try again.

If it still doesn't work, rather than posting screenshots it's probably better to do a quick screenshare and I'll figure it out. Let me know when you're around.

SanfordWhiteman
Level 10 - Community Moderator

It shows "Paused in debugger". Do you have a breakpoint set? Nothing will run while paused.