Track number of submissions of Landing page via javascript


#1

Hello.
I would like to know exactly where does Hubspot takes its number for "Submissions" and "Contacts created" when viewing the Performance tab of a Landing page.

I would like to track the number of submissions, however I am not using a hubspot form inside the page. I'm using html+javascript to do an ajax call to my external application website.

Does it only work with the generic "Form" module of Hubspot?
If I post data via Javascript to the form of my choosing, will it increase the count?

Thanks


#2

Hi @Sheikz,

The numbers on the page performance tab are incremented by submissions coming in that include the page's pageId in the hscontext info. If you can submit that pageId in the hscontext block via the forms API, it should update the performance stats of the page. You'd need to use the content APIs to pull the page IDs, though:


#3

Hello Derek,

Thanks a lot for the reply.
The Hubspot API does not mention this field in the doc, is that a hidden field?
Only pageName and pageUrl are documented which I use already in my code.

It would be great if the Hubspot backend could infer the pageId from the pageUrl, since it is unique (except for A/B testing pages)

Thanks,
Thomas


#4

Hi @Sheikz,

It's not hidden, it's just primarily used internally. I can work on updating the documentation going forward. Also, I can definitely appreciate the usefulness of inferring pageId from the pageUrl. I'm happy to pass that feedback along internally, but if you have the inclination, I would also encourage you to check out the Ideas Forum on the HubSpot Community. The Ideas Forum is where we're aggregating all product feedback, including API related feedback, and it's the best place to make your idea visible to HubSpotters.