I'm trying to use script tags. I've created a file called store.js in my server. When I enter to my store I can see that the file is there and everything it's ok. The question is : How can I know the shop url (shopname.myshopify.com) that executed my file? I saw another post about this but I didn't understand it. It says to create a js file with an identifier. I'm not sure I understand how to do such thing.
If you can show me a clear example it would be great. BTW I use PHP, Jquery & Ajax.
Boom! I did it and here is the simple answer for all people looking for a solution with php.
I checked my html source on my shop and shopify added this to my js file first time I tried with a js file :
So I thought about it and in the json string, I send a php file instead a js file like this :
array('event' => 'onload','src' => 'https://myserver.com/scripts/script.php');
Since php files can receive parameters, I just receive the parameter with the GET method :
$shop = $_GET['shop'];
I hope it helps ;)
|an hour ago|
|3 hours ago|
|6 hours ago|