I would like to add the like button of the customer community to the product feature mapper of px.

Can I use the class in some way?

I would like to add the like button of the customer community to the product feature mapper of px.
Can I use the class in some way?
Yes, you can use the selector:
.icon--thumb-up
or
[class=”icon--thumb-up”]
That’s the same selector written 2 different ways. That will track the article page likes, and the likes from article lists as well, assuming you keep the url scope in your product mapper rule open to those views, like subdomain.domain.com/*
Awesome .. thanks
Am I also able to add the page title to the event? I would like to see WHAT people are liking as well.
Hi Alistair. It’s not possible to add additional metadata to standard PX events like page view and click, but that’s where custom events come in.
In CC, we need to add event listeners to the Third Party Scripts “Before </Body>” section. From these event listeners, we can send PX custom events, including DOM attributes from the inSidedData object.
For example:
<!--begin PX Custom Event: Topic Like-->
<script>
var likeButton = document.querySelector(".icon--thumb-up");
if(likeButton!=null){
likeButton.addEventListener("click", e => {
aptrinsic('track','Like Button Clicked',{'title':inSidedData.content.topic.title,'type':inSidedData.content.topic.type});
});
}
</script>
<!--end PX Custom Event: Topic Like-->
That script looks for the like button on the page, and if that like button exists, listens for a click. When clicked, there is a PX custom event that sends the Title and Type attributes from inSidedData.content.topic
In PX we see these events like this:
https://share.zight.com/5zuk7EQQ
From there, raw custom events that flow to PX can be used in product mapper rules (custom event rules) and engagement audience logic (custom event rules). The custom events can also be accessed directly in Query Builder for reporting purposes (event type = custom event).
Awesome,
I have added the code provided
and created the custom event in PX, named Like Button Clicked.
Looking through the set up that should be it right?
I do not appear to be getting data sent through.
Am I missing something?
Thank for the expert guidance.
It looks like there might be a copy/paste problem with the comments. Try deleting the open and close comments so that the <script> and </script> are the first and last elements in the code block
I have made those changes and still no luck. If I paste the aptrinsic command into the console I get the event sent (minus the additional Attributes).
So what I am seeing is the EventListener not hearing the click.
Yeah, that’s confusing. I checked the script on a public page in your community, and everything looks great. The query selector is getting set properly, and your event listener is exactly the same as the one I have running in a few community sites.
You might check with support if there’s some reason why this event isn’t firing. You can point them to https://robschlette-en-sandbox-community.insided.com/getting-started-in-the-community-2/we-re-launching-the-new-community-26 to see the same script in action
If you ever had a profile with us, there's no need to create another one.
Don't worry if your email address has since changed, or you can't remember your login, just let us know at community@gainsight.com and we'll help you get started from where you left.
Else, please continue with the registration below.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.