Mautic Community Forums

Tracking Pixel Configuration

I just installed a self-hosted version of Mautic. It’s located in “root/mautic/”



I’m trying to get the tracking pixel working but as far as I can tell, the only tracking I’m getting is from a form I set up and from emails.



I’ve manually inserted the following codes, hoping one of them might work:

Code:

I followed this documentation: https://www.mautic.org/docs/leads/lead_monitoring.html as well as a few different threads on this forum but to no avail, none of my codes seem to be registering.

I've also tried visiting the page using different browsers and on networks I'm not logged into Mautic on, no luck yet.

I just installed a self-hosted version of Mautic. It’s located in “root/mautic/”

I’m trying to get the tracking pixel working but as far as I can tell, the only tracking I’m getting is from a form I set up and from emails.

I’ve manually inserted the following codes, hoping one of them might work:

<img src='http://example.com/mautic/mtracking.gif?url=example.com%2F&title=title&email=email@example.com' style='display: none;' /> <img src='http://example.com/mtracking.gif?url=http://example.com%2F&title=title&email=email@example.com' style='display: none;' /> <img src='http://example.com/mautic/mtracking.gif' style='display: none;' /> <img src='http://example.com/mtracking.gif' style='display: none;' />

I followed this documentation: https://www.mautic.org/docs/leads/lead_monitoring.html as well as a few different threads on this forum but to no avail, none of my codes seem to be registering.

I’ve also tried visiting the page using different browsers and on networks I’m not logged into Mautic on, no luck yet.

Hi Dzawacki

None of the codes you created are in the proper format. As shown in the documentation you linked too, the tracking pixel must be serialized and base64-encoded. There’s a PHP example on the documentation which shows how to do that.

The next thing you need to do is past the data in the serialized / encoded values as the “value” of the ‘d’ url query parameter:

<img src="http://yourdomain.com/mtracking.gif?d=[serialized & url-encoded values here]" />

Okay, I see what I was doing wrong. I wish the documentation was a little more explicit about what needs to be done.

I’m still not seeing any tracking though. I copied the code from the example, and updated it so the correct variables are being passed and it’s still not registering. My code looks like:

[code]$d = urlencode(base64_encode(serialize(array(
‘url’ => $_SERVER[‘REQUEST_URI’],
‘title’ => $TITLE, // Use your website’s means of retrieving the title or manually insert it
‘email’ => $_SESSION[‘email’] // Use your website’s means of user management to retrieve the email
))));

echo ‘’;[/code]

Since my Mautic installation is installed in a sub folder of my domain, does my image source URL need to be example.com/mtracking.gif...or should it be example.com/mautic/mtracking.gif…?

Hi:

You definitely need to have the correct path to Mautic. A good test is if you can load the tracking pixel in your browser without getting a 404:

If you get a 404 its not going to work:
https://www.evernote.com/l/ACpJS0va0U5NkoJ3FpPNNLzryD1KppJ8ObcB/image.png

If you visit it and you get a blank page (because of the transparent pixel) then it should be working properly.

I copied the URL of Mautic and placed it in my code (because my variable was storing the wrong URL for this):

[code]$d = urlencode(base64_encode(serialize(array(
‘url’ => $_SERVER[‘REQUEST_URI’],
‘title’ => $TITLE, // Use your website’s means of retrieving the title or manually insert it
‘email’ => $_SESSION[‘email’] // Use your website’s means of user management to retrieve the email
))));

echo ‘’;[/code]

…and I’m still not seeing any tracking happening. I am getting the 404 error. Any thoughts on where to start to debug this?

If you’re getting a 404 and you’re sure the path is correct its possible your .htaccess file is not set up correctly. The mtracking.gif file is not a real, physical file. It’s dynamically created and served via mautic and some php handlers.

Can you check your apache error logs to see if there’s any errors related to mod_rewrite?

I checked the logs and everything I’m seeing associated with Mautic in the logs is returning a 200 code.

I didn’t find any mod_rewrite errors.

Could you post the link to your mautic login page? it would really help.

http://friendshipmate.com/mautic/index.php/s/login

Figured it out. There was no .htaccess file included in my download of Mautic. I created the file in the Mautic installation folder. Tracking is now working.

Thanks for your help on this Chad, best response time I’ve ever seen on a forum!

Ah yay! I was just going to post to tell you to check for the .htaccess file. It should be included - its possible that it didn’t get uploaded or that your host actually deleted it (I’ve seen that!).

Glad its working!

Hi,

Sorry to jump onto the end of this thread and if it is a dumb set of questions.

I have just installed Mautic on my site and now wanting to set up the basics, but I am lost at square one with the tracking pixel.

I have a standard .php site - not Wordpress, Drupal, etc.

It would therefore seem that I will need to use the code as described above, i.e.;

[code]$d = urlencode(base64_encode(serialize(array(
‘url’ => $_SERVER[‘REQUEST_URI’],
‘title’ => $TITLE, // Use your website’s means of retrieving the title or manually insert it
‘email’ => $_SESSION[‘email’] // Use your website’s means of user management to retrieve the email
))));

echo ‘’;
[/code]

So my questions are;

  1. I presume that I just enter the above code on my page encased with the normal <?php ?> php tags?
  2. Is there any specific area to place the code - above the tag, in the or the ?
  3. Does that code have to go onto every page on my site that I want tracked or just my main index.php page?
  4. What if I have marketing that takes people to landing pages and not the main index?
  5. I presume the ‘title’ is the page title for each page that I have that code on?
  6. I don’t understand the significance of the ‘email’ variable. You say ‘Use your website’s means of user management to retrieve the email’ - but what eMail are you talking about here? What eMail is generated and what is its purpose? Is it an actual eMail address or something else such as ‘PHP Mail()’ or ‘PHPMailer’ etc?

Also one more question off topic while I am here, with the cron jobs, how often do you recommend that they are run?

Thanks kindly,

  • Neil