change the email subject with dynamic pages

Hello !
I have a web site with dynamic pages with a sending email button but I want to custom the email subject with the name of the page, because I need to now from wich page its coming from when i receive an email

thanks.

Hello omenibus,

with this code-snipet here…

import wixLocation from 'wix-location';

$w.onReady(function () {
    let siteURL = wixLocation.url
    console.log(siteURL)
});

In this case you get the site-url when a page loads.

Your first step is done (everytime when you change a site, you have always the current site-URL)

Thanks russian-dima !

Little upgrade…

import {session} from 'wix-storage';
import wixLocation from 'wix-location';
import wixUsers from 'wix-users';

$w.onReady(function () {
 let siteURL = wixLocation.url
    console.log(siteURL)                                //---> Shows the URL of current-website (PRESS-F12 in google-chrome-browser)

 let userEmail = wixUsers.currentUser.getEmail() 
    console.log(userEmail)                              //---> Shows the E-Mail of current-user (PRESS-F12 in google-chrome-browser)
    
 let previousPageURL = session.getItem("page");
    console.log(previousPageURL)                        //---> Shows the last visited website (PRESS-F12 in google-chrome-browser)
}); 

Perhaps it will help you in the future.

someone else?

Hi @omenibus ,

You can get the page name (It differ from language to language).

1) Import Wix Site & Wix Location API modules

import wixSite from 'wix-site';
import wixLocation from 'wix-location';

2) Get the site name

let pageDetails = {
        pageName: wixSite.currentPage.name,
        pageUrl: wixSite.currentPage.url,
        pagePrefix: wixLocation.prefix
}        

The Prefix is the constant part of the dynamic page’s URL, or the APP part, for example the Wix Stores App has a prefix (product-page) in its URL.

Hope that helped!
Ahmad