# Send a "Tracking" POST withou Pageview?

**URL:** <https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874>\
**Category:** Development\
**Created:** [July 26, 2022, 1:49pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874 "2022-07-26T13:49:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonardoborlot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leonardoborlot/32/72_2.png) [@leonardoborlot](https://forum.mautic.org/u/leonardoborlot)\
**Post date:** [July 26, 2022, 1:49pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/1 "2022-07-26T13:49:21Z")

</div>

Hi people, Im developing an integration from Tracking Js Script.  
Theres any way to send a “Post” without ‘pageview’ argument in 'mt ’ payload?  
I want to send custom field values, but donw want to send a new page view.  
I did it work from gif tracking, but, the js has some more information to send.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 26, 2022, 6:21pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/2 "2022-07-26T18:21:49Z")

</div>

Also interested 😉 plz keep the answers coming.

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [July 27, 2022, 3:54pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/3 "2022-07-27T15:54:52Z")

</div>

That would be truly nice.  
Do you want to send it after the initial send event on pageload?  
Like: If someone scrolls to 20% of page then send again?  
Or would it be ok to send it directly at the beginning?

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [July 27, 2022, 4:20pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/4 "2022-07-27T16:20:58Z")

</div>

What happens when you call with something other than pageview param and data? Check if it still records page hit if you set ‘mytestdatatransfer’ instead of ‘pageview’,

---

<div class="post-metadata">

**Author:** ![steverobinson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/steverobinson/32/174_2.png) [@steverobinson](https://forum.mautic.org/u/steverobinson)\
**Post date:** [July 27, 2022, 4:41pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/5 "2022-07-27T16:41:11Z")

</div>

In my experience, if you send any event other than “pageview” the event never gets picked up on the Mautic side, so any field updates are missed as well.

---

<div class="post-metadata">

**Author:** ![leonardoborlot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leonardoborlot/32/72_2.png) [@leonardoborlot](https://forum.mautic.org/u/leonardoborlot)\
**Post date:** [July 27, 2022, 5:21pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/6 "2022-07-27T17:21:35Z")

</div>

Yes, you can send the same payload, but, when you don´t send pageview string, Mautic dont accep the request. theres no error, just nothing happends…

---

<div class="post-metadata">

**Author:** ![leonardoborlot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leonardoborlot/32/72_2.png) [@leonardoborlot](https://forum.mautic.org/u/leonardoborlot)\
**Post date:** [July 27, 2022, 5:23pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/7 "2022-07-27T17:23:10Z")

</div>

> [@alexhammer](#):
>
> That would be truly nice.  
> Do you want to send it after the initial send event on pageload?  
> Like: If someone scrolls to 20% of page then send again?  
> Or would it be ok to send it directly at the beginning?

I want to send data about the product os the purchase, but dont need to register the page view again, the “original” tracking was doing this.  
I just want to update the fields.

---

<div class="post-metadata">

**Author:** ![steverobinson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/steverobinson/32/174_2.png) [@steverobinson](https://forum.mautic.org/u/steverobinson)\
**Post date:** [July 27, 2022, 6:33pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/8 "2022-07-27T18:33:27Z")

</div>

We have this exact need as well ☹

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [July 28, 2022, 10:31am UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/9 "2022-07-28T10:31:28Z")

</div>

I mean the easiest way is probably to create another public api endpoint (custom plugin), the most proper way would probably be to extend mautic in a way that it accepts something other than pageview param.

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [August 4, 2022, 11:24am UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/10 "2022-08-04T11:24:01Z")

</div>

I came up with this simple script today. Of course you need to fit it to your needs and use some other things like fetching the id of the current visitor to use it within the script but maybe it helps:

```auto
//create Mautic URL for API Call
var mauticUrl = "https://yourmauticurl.com";
var apiEndpoint = "/api/contacts/ID/edit"; //change ID to the contactID you want to change 
var urlForXhr = mauticUrl + apiEndpoint
// user credentials for Basic Auth
var user = "mauticuser";
var password = "safepassword";
// Encode the user and password to base64 
var encodedAuthString = btoa(user + ":" + password);
console.log(encodedAuthString);
// make the httpRequest
var xhr = new XMLHttpRequest();
xhr.open("PUT", url);

xhr.setRequestHeader("Authorization", "Basic " + encodedAuthString);
xhr.setRequestHeader("Content-Type", "application/json");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
      console.log(xhr.status);
      console.log(xhr.responseText);
   }};
// input the data you want to insert
var data = `{
  "firstname": "Mister",
  "lastname": "Beast"
}`;

xhr.send(data);

```

Maybe it is a start? Would be great to hack around a little bit more 🙂

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [August 4, 2022, 11:43am UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/11 "2022-08-04T11:43:54Z")

</div>

which platform do you use for the cart/checkout?  
Do you have the data available?  
You could simply send the data via the API to Mautic.  
That is what most Plugins do anyway.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 4, 2022, 12:46pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/12 "2022-08-04T12:46:28Z")

</div>

Is this javascript? If yes, then your psw will be exposed in my opinion.

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [August 4, 2022, 12:53pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/13 "2022-08-04T12:53:05Z")

</div>

Yes that’s JS. And yes. If you use basic auth it would be exposed if you put the script directly to the page. Better to store the script on the server and simply call it via an event. If you use https it should be safe. Of course someone with server-access can see the password in the script file.

The better solution would be to use oauth2 for that. But that takes a little bit more work…

---

<div class="post-metadata">

**Author:** ![leonardoborlot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leonardoborlot/32/72_2.png) [@leonardoborlot](https://forum.mautic.org/u/leonardoborlot)\
**Post date:** [August 4, 2022, 1:35pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/14 "2022-08-04T13:35:01Z")

</div>

Alex  
Maybe you collet any object and send this payload to a php function for this file execute the API request, did will hide your credentials.

But, for my question, this is “haevy” request (call api, autentication, payload, update…), think this for a site with 2k simultaneos visit…  
From jscript is light, as a void connection, recive the request without callback. I just want to do it more light, more fast and more efficient.

---

<div class="post-metadata">

**Author:** ![sfahrenkrog1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sfahrenkrog1/32/4583_2.png) [@sfahrenkrog1](https://forum.mautic.org/u/sfahrenkrog1)\
**Post date:** [August 5, 2022, 7:15am UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/15 "2022-08-05T07:15:04Z")

</div>

> [@leonardoborlot](#):
>
> I did it work from gif tracking, but, the js has some more information to send.

Hey leonardoborlot

I’m wondering:  
Which informations are you missing in the gif tracking?

You could load the mtracking.gif also via javascript and append every parameter needed. So there should be nothing missing .

But using mtracking.gif will produce pagehit Entries in the lead detail page.

Could you give an example?

---

<div class="post-metadata">

**Author:** ![alexhammer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alexhammer/32/14525_2.png) [@alexhammer](https://forum.mautic.org/u/alexhammer)\
**Post date:** [August 6, 2022, 7:57am UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/16 "2022-08-06T07:57:41Z")

</div>

@leonardoborlot if you have very high traffic, it is likely that your Mautic server is not responding for every other call you send. Therefore you could build a queue with a database to truly get every call and make sure you don’t miss something because mautic is currently busy with other cronjobs, locked database und so on.

---

<div class="post-metadata">

**Author:** ![leoschuler](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leoschuler/32/4798_2.png) [@leoschuler](https://forum.mautic.org/u/leoschuler)\
**Post date:** [August 10, 2022, 7:44pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/17 "2022-08-10T19:44:38Z")

</div>

I implemented a similar solution, but I could not avoid the page view event, I just work with it, check the video and see if this is similar to what you need:

[![](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/471d4aea5b7b8dd9074baf6b015cafefa7f86436.jpeg "Tracking Custom Events in Mautic") ](https://www.youtube.com/watch?v=tODrdGpDPEY)

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 11, 2022, 12:42pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/18 "2022-08-11T12:42:39Z")

</div>

Another hunch:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0ebaf2f69e6dac8d0901edd6a714a359fed3b394.png)

source:  
[https://docs.maatoo.io/?php#pageviews](https://docs.maatoo.io/?php#pageviews)

---

<div class="post-metadata">

**Author:** ![sfahrenkrog1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sfahrenkrog1/32/4583_2.png) [@sfahrenkrog1](https://forum.mautic.org/u/sfahrenkrog1)\
**Post date:** [August 11, 2022, 1:38pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/19 "2022-08-11T13:38:11Z")

</div>

I found a hack to send events without any informations in the lead profile (with one little exception: you need to set a tag but it could be always the same)

You send a request to

`/dwc/<RANDOMSTRING>?<PUBLICFIELDALIAS>=<VALUE>&tags=<ANYTAGYOULIKE>`

```auto
Replace <RANDOMSTRING> with any string you like, and replace <PUBLICFIELDALIAS> with the alias you like to update and <VALUE> with the value. 

<ANYTAGYOULIKE> could be any tag. It is just to force lead update. 

Example with my mautic development instance: 
https://m.dev.testserver.online/dwc/randomstring?uuid=SEBASTIAN&tags=save

uuid is a public field in my instance 
and tags could be any value you like (this is just to force lead update for the field)

```

---

<div class="post-metadata">

**Author:** ![leonardoborlot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leonardoborlot/32/72_2.png) [@leonardoborlot](https://forum.mautic.org/u/leonardoborlot)\
**Post date:** [August 11, 2022, 2:03pm UTC](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874/20 "2022-08-11T14:03:46Z")

</div>

good ideia. good vídeo.  
but, think so, you don need to create a new line in database to registra this page view, just to send a new tag change or add points.

This is whats we are looking for.

[Next page](https://forum.mautic.org/t/send-a-tracking-post-withou-pageview/24874.md?page=2)
